V2 4893 kitty keyboard shifted fix - #4894
Conversation
tig
left a comment
There was a problem hiding this comment.
Thanks for fixing this. I noticed something odd the other day with the ansi driver in this regard and immediately forgot about it because I needed to use the windows driver to test something else and never switched back.
There was a problem hiding this comment.
Pull request overview
Fixes kitty keyboard protocol handling so shifted printable CSI u keys and kitty “associated text” are preserved and normalized into printable Key semantics, improving text-entry behavior across views.
Changes:
- Request kitty
ReportAssociatedTextand parse associated-text payloads inKittyKeyboardPattern. - Normalize shifted-printable kitty sequences so keys like
Shift+2resolve to'@'(not base key + Shift). - Add/update unit tests across keyboard parsing,
Keyprintable resolution, and text-entry views.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Terminal.Gui/Input/Keyboard/Key.cs | Adds AssociatedText, updates printable resolution (AsRune), and introduces GetPrintableText/TryGetPrintableRune. |
| Terminal.Gui/Drivers/AnsiHandling/KittyKeyboardPattern.cs | Extends kitty CSI u parsing to extract associated text and normalizes shifted printable keys. |
| Terminal.Gui/Drivers/AnsiHandling/EscSeqUtils/EscSeqUtils.cs | Requests kitty ReportAssociatedText in the negotiated flags. |
| Tests/UnitTestsParallelizable/Input/Keyboard/KeyTests.cs | Adds tests for printable-text resolution preference order and multi-rune associated text behavior. |
| Tests/UnitTestsParallelizable/Drivers/AnsiHandling/KittyKeyboardParsingTests.cs | Updates fixtures to coherent US-keyboard examples; adds associated-text parsing and requested-flag assertions. |
| Tests/UnitTestsParallelizable/Drivers/AnsiHandling/KittyAlternateKeyTests.cs | Updates alternate-key fixtures and adds associated-text preservation tests. |
| Tests/UnitTestsParallelizable/Views/TextFieldTests.cs | Adds tests for associated-text insertion and shifted-digit behavior without kitty metadata. |
| Tests/UnitTestsParallelizable/Views/TextView.InputTests.cs | Adds test ensuring associated-text shifted printable inserts expected text. |
| Tests/UnitTestsParallelizable/Views/TextValidateFieldTests.cs | Adds test ensuring associated-text shifted printable is accepted by regex provider. |
…_kitty-keyboard-shifted-fix
|
Excellent work. Thank you. |
|
On Windows, I'm only capturing the shift key and nothing else. I tried with WezTerm and Rio. I don't know why this happens. Have you managed to get this working on Windows? |
|
Which Windows Terminal version you're using? |
|
Windows Terminal Preview |

Fixes
Proposed Changes/Todos
ReportAssociatedTextsupport in the requested keyboard flags.Key.Key.TextField,TextView, andTextValidateFieldtests to cover shifted printable behavior and associated text handling.Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)