-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add keybindings for CTRL, ALT, SHIFT + UP, DOWN, RIGHT, LEFT, HOME, END, BACKSPACE, DELETE & more #3996
base: master
Are you sure you want to change the base?
Conversation
Thanks, I'll review the code when I get some time. A few things.
|
No worries, take your time.
Yep, I checked
True. Do you write the man page by hand? I was hoping it might be generated by some docstring, although I didn't find one when I searched for it.
SGTM. I use
I tried to stick as close to your implementation as possible and saw this |
d7d08bc
to
aad5e49
Compare
I made the mentioned changes and the remaining exciting question is if the following block ( case tcell.KeyBackspace2:
if ctrlAlt {
return Event{CtrlAltBackspace, 0, nil}
}
if ctrl {
return Event{CtrlBackspace, 0, nil}
}
if alt {
return Event{AltBackspace, 0, nil}
}
return Event{Backspace, 0, nil} My educated guess is that it is actually not and has to be covered in the following block: case tcell.KeyCtrlH:
switch ev.Rune() {
case 0:
if ctrl {
return Event{Backspace, 0, nil}
}
case rune(tcell.KeyCtrlH):
switch {
case ctrl:
return keyfn('h')
case alt:
return Event{AltBackspace, 0, nil}
case none, shift:
return Event{Backspace, 0, nil}
}
} |
You can run |
Thanks for the hint! But I am trying to get my hands on a windows machine as well because it all depends on what the OS is really gonna send. I will report back after that. |
aad5e49
to
d90cff2
Compare
d90cff2
to
e948d0f
Compare
is this ready for merging? |
Nope, not yet. The Linux implementation is done. Windows implementation potentially as well, but requires a patch in tcell to make the following shortcuts work:
That's why this PR currently points to my own fork of You can build this PR yourself. That should work. |
This PR implements some missing key bindings.
In particular all possible combinations of
CTRL
ALT
SHIFT
ALT+SHIFT
CTRL+ALT
CTRL+SHIFT
CTRL+ALT+SHIFT
in conjunction with
Up
,Down
,Left
,Right
,Home
,End
,Backspace
,Delete
,PageUp
,PageDown
.I added tests to the
LightRenderer
beforehand to make sure I wasn't breaking anything, and expanded them when I added new key bindings.So you can actually do stuff like:
This PR fixes #1747.