-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Enable progressive keyboard enhancement protocol #4939
Conversation
Oh oops I just made #4961 that also adds C-i. Even without progressive keyboard enhancement it's needed for it to work on Windows and it doesn't seem to affect Linux. Can you merge mine first please, as it closes some issues? |
4a4b1de
to
b6b1bea
Compare
The upstream crossterm PR was merged so we just wait on a release now. (Hopefully the next one will also include the PR for #5468.) There's some odd behavior with the key events you get and the shift modifier so there may need to be more changes to the default keymap: the-mikedavis@4be72f7 |
Closes #1368 |
Hey, crossterm just released 0.26, see #5468 |
I tested out 0.26 and there have been some new changes that caused a regression with the function that checks for the keyboard enhancement protocol. I'll post a PR to fix that so this will need to wait on the next crossterm release |
Since there's often significant time between releases of crossterm, I wonder if we could fork it to the |
Yeah that seems like a nice compromise to me 👍 We could just use this |
b6b1bea
to
88d1efa
Compare
I think that's enough, even if we fork I'd list it as a git dependency. It's a workaround specific to our use case and I'd avoid someone else depending on it by accident |
This is now waiting on another PR to crossterm now that adds support for the "report alternate keys" part of the Kitty Keyboard Protocol: https://sw.kovidgoyal.net/kitty/keyboard-protocol/#report-alternate-keys. Some keys arrive weirdly when the protocol is enabled: KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES |
KeyboardEnhancementFlags::REPORT_ALTERNATE_KEYS in crossterm. Then here it overwrites the unshifted key with the shifted key. (Update: that was merged! 🎉) |
88d1efa
to
44de88a
Compare
44de88a
to
b77fb5e
Compare
@@ -363,7 +363,7 @@ pub fn default() -> HashMap<Mode, Keymap> { | |||
"A-d" | "A-del" => delete_word_forward, | |||
"C-u" => kill_to_line_start, | |||
"C-k" => kill_to_line_end, | |||
"C-h" | "backspace" => delete_char_backward, | |||
"C-h" | "backspace" | "S-backspace" => delete_char_backward, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there other keybindings that might have worked without this feature but don't work anymore now?
If that is the case should we offer a config option to dsiable this feature? Also I think this technically qualifies as a breaking change because people could have custom keybdings for backspace (or other ambiguous key-codes) like this which would stop working. I added the appropriate label so we don't forget about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ambiguous keycodes like using C-i
for tab
or using C-backspace
for C-h
would change but I think those would be pretty rare. I'm not sure how I feel about a config option for this: if the protocol is enabled then you get more predictable and correct key events - you would only disable it if you wanted to use ambiguous keycodes which I don't think has any advantage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds reasonable 👍 I think we should keep the breaking change label tough so this PR is a bit easier to find for people who do experience regressions.
I think this closes #5765 btw |
b77fb5e
to
dba95f5
Compare
Crossterm 0.26.x includes a breaking change for the command to set the cursor shape. This commit includes a change which uses the new type.
When the Kitty Keyboard Protocol is enabled, S-backspace is distinguished from backspace with no modifiers. This is awkward when typing because it's very easy to accidentally hold shift and press backspace temporarily when typing capital letters. Kakoune (which is also a Kitty Keyboard Protocol application) treats S-backspace as backspace too: https://github.com/mawww/kakoune/blob/3150e9b3cd8e61d9bc68245d67822614d4376cf4/src/input_handler.cc#L1275
dba95f5
to
1b50b60
Compare
See the Kitty documentation on this: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
Key events given by the terminal are limited by default: the terminal confuses keycodes like C-i and tab and can't tell the difference between backspace and S-backspace or ret and S-ret. We can detect support for an enhanced keyboard protocol and enable that protocol to be able to disambiguate these keys on terminals which support the protocol.
Closes #3725
Closes #3210
Closes #1085
Closes #5765