Repository navigation
Conversation
On win32, a Ctrl+key press reaches the core as a raw WM_KEYDOWN event with no utf8 text, and the WM_CHAR generated for it is a C0 control character that handleTextInput intentionally drops. The legacy encoder handles most Ctrl keys from the logical key alone, but leaves Ctrl+[, Ctrl+i and Ctrl+m (CSI u per fixterms) and punctuation such as Ctrl+, to the event's text, so those keys sent nothing at all. Pass the key's unshifted character as text for Ctrl-only presses, as the GTK apprt does, so the encoder produces the same output as on other platforms: Ctrl+[ -> \e[91;5u, Ctrl+i -> \e[105;5u, Ctrl+m -> \e[109;5u, Ctrl+, -> \e[44;5u. Ctrl+letters and digits are unchanged. Presses with Shift, Alt (including AltGr) or Super keep the existing behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
On win32, Ctrl+[, Ctrl+i, Ctrl+m (and punctuation like Ctrl+,) send nothing to the terminal.
Cause: Ctrl+key presses reach the core as a raw
WM_KEYDOWNevent with noutf8. TheWM_CHARthat follows is a C0 control character, whichhandleTextInputintentionally drops. The legacy encoder handles most Ctrl keys from the logical key, but leaves[,i,m(CSI u per fixterms) and punctuation to the event's text, so they produce no output.Fix: for Ctrl-only presses, pass the key's unshifted character as
utf8, matching what the GTK apprt sends. Shift/Alt/AltGr/Super combinations are unchanged.Tested on Windows 11 (x64 build cross-compiled with Zig 0.16 from WSL), legacy encoding, raw byte logger:
\e[91;5u\e[105;5u\e[109;5u\e[44;5u\x01\x01\e\eAI disclosure: I used Claude Code (Claude Opus 5.5) to trace the cause through
App.zigandkey_encode.zig, write the change, and draft this description. I reviewed the change and ran the tests above myself.🤖 Generated with Claude Code