Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigate by word in prompts #795

Open
StefanMich opened this issue Apr 20, 2020 · 8 comments
Open

Navigate by word in prompts #795

StefanMich opened this issue Apr 20, 2020 · 8 comments
Labels
bug Something isn't working gocui usability

Comments

@StefanMich
Copy link

Describe the bug
In prompts with text fields (commit, checkout, etc..), I would like to navigate by word, which is implemented in most textfields other places (text editors, browsers, etc.).
When I press ctrl + left arrow as I am used to, lazygit interprets the key combination as a shortcut which operates in the menu, and not in the text field

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Local branches'
  2. Press 'c' for checkout by name
  3. Type some text...
  4. Press ctrl + left arrow

Expected behavior
Cursor moves to the beginning of the word

Desktop (please complete the following information):

  • OS: Ubuntu 19.10
  • Lazygit Version: build date=2020-04-10, build source=debian, version=0.18, os=linux, arch=amd64
@StefanMich StefanMich added the bug Something isn't working label Apr 20, 2020
@jesseduffield
Copy link
Owner

Agreed that this should be a thing. I'm not sure that termbox (one of our dependencies) supports those keys, but I'm assuming there must be some way to read them. Then it's just a matter of adding handlers for those keys in gocui's (another one of our dependencies)simpleEditor function

@joejoe87577
Copy link

Maybe you could extend this functionality and also use the home and end keys. We use a different naming convention for our branches and when checking out a branch it always means removing the "origin" from the name.

@murphy66
Copy link
Contributor

murphy66 commented Jan 17, 2021

I made a pull request that adds this functionality: #1142

@mloskot
Copy link

mloskot commented May 23, 2023

I have just some puzzling moments while not being able to move cursor by word with CTRL+Left/Right in the commit dialog.
Or perhaps this issue is old now and there is a way to jump between words, instead of between characters?

Update: I've just checked Ctrl+B/F as per #2104 but it does not work for me either in version 0.38.2 on Windows (Git Bash).

@Armadillidiid
Copy link

I have just some puzzling moments while not being able to move cursor by word with CTRL+Left/Right in the commit dialog. Or perhaps this issue is old now and there is a way to jump between words, instead of between characters?

Update: I've just checked Ctrl+B/F as per #2104 but it does not work for me either in version 0.38.2 on Windows (Git Bash).

Same over here. None of the keybinds work for me.

@fengjianyun
Copy link

Same here. And besides Ctrl + Arrow to move a word, I request also for Ctrl + Backspace / Ctrl + Del to remove a word.

@stefanhaller
Copy link
Collaborator

Move by word is mapped to alt + left/right, not ctrl. I'm relatively sure that this is because ctrl is not technically possible (unless the underlying tcell library implements gdamore/tcell#671).

Delete word is available, and mapped to ctrl-w.

@fengjianyun
Copy link

Move by word is mapped to alt + left/right, not ctrl. I'm relatively sure that this is because ctrl is not technically possible (unless the underlying tcell library implements gdamore/tcell#671).

Delete word is available, and mapped to ctrl-w.

Thank you very much !
My Lazygit is 0.40.2 installed in WSL 2 (Ubuntu 20.04), I can confirm Ctrl + w works like a charm and move by words is Alt + Shift + Arrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gocui usability
Projects
None yet
Development

No branches or pull requests

8 participants