feat(tui): enables the kitty keyboard-protocol and enable support for uppercase keybindings#1030
Open
delafthi wants to merge 2 commits intoalexpasmantier:mainfrom
Open
feat(tui): enables the kitty keyboard-protocol and enable support for uppercase keybindings#1030delafthi wants to merge 2 commits intoalexpasmantier:mainfrom
delafthi wants to merge 2 commits intoalexpasmantier:mainfrom
Conversation
delafthi
commented
Apr 9, 2026
Comment on lines
+383
to
+395
| Char(c) => { | ||
| let c = if event.modifiers.contains(KeyModifiers::SHIFT) { | ||
| c.to_uppercase().next().unwrap_or(c) | ||
| } else { | ||
| c | ||
| }; | ||
| match event.modifiers - KeyModifiers::SHIFT { | ||
| KeyModifiers::NONE => Key::Char(c), | ||
| KeyModifiers::CONTROL => Key::Ctrl(c), | ||
| KeyModifiers::ALT => Key::Alt(c), | ||
| _ => Key::Null, | ||
| } | ||
| } |
Contributor
Author
There was a problem hiding this comment.
When a shifted key is pressed, it is reported as:
2026-04-09T20:48:46.857697Z TRACE television/event.rs:328: Raw event: KeyEvent { code: Char('d'), modifiers: KeyModifiers(SHIFT | CONTROL), kind: Press, state: KeyEventState(0x0) }
Here the shift modifier is first applied to the character, then the other modifiers are processed. This ensures that shifted keys work correctly on characters with all currently supported modifiers.
3d28ced to
12e27d7
Compare
Contributor
Author
|
I'm struggling with the tests. I'm not sure why some of them are breaking. Probably, because some of them have timing issue due to the additional check for kitty keyboard protocol support. |
12e27d7 to
5ee5c39
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📺 PR Description
This PR checks if the terminal supports the kitty keyboard protocol and enables it if supported. It also adds support for defining uppercase bindings, such as
Ctrl-DorCtrl-Shift-d.However, on terminals that don't support the kitty keyboard protocol (like tmux; let's hope tmux PR #4912 gets merged), the shift key information is not propagated to
tv. This means that if bindings for bothctrl-dandCtrl-Dare defined, only thectrl-daction will be executed, since the shifted binding cannot be distinguished from the unshifted one.The feature was tested in Ghostty.
Checklist
Resolves #966