Repository navigation
Route send-next-key through the key encoder - #596
Merged
Merged
Conversation
The send-next-key escape hatch wrote C0 and printable-ASCII events to the PTY as raw bytes, bypassing the key encoder. A child that enabled the kitty keyboard protocol then received bytes outside the negotiated encoding, e.g. a bare ESC where the disambiguate flag promises CSI 27u. Extract the event decoding from ghostel--send-event into ghostel--event-key-spec and use it for send-next-key too, so raw Enter/Tab/ESC bytes map to the functional key rather than a ctrl chord and every key with an encoder representation goes through the terminal's negotiated encoding. Legacy children see byte-identical output for unmodified and ctrl-chord C0/ASCII input; ctrl+shift chords now encode CSI-u like ghostel--send-event already did for bound keys. Non-ASCII characters keep the UTF-8 fallback, and the rescue commands (ghostel-send-C-c and friends) intentionally keep sending raw bytes so the line discipline acts on them regardless of the child's protocol state.
This branch was previously deployed
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.
Summary
ghostel-send-next-key(C-c C-q) wrote C0 and printable-ASCII events to the PTY as raw bytes, bypassing the key encoder. A child that enabled the kitty keyboard protocol then received bytes outside the negotiated encoding — e.g. a bareESCwhere the disambiguate flag promisesCSI 27u.Changes
ghostel--send-eventinto a sharedghostel--event-key-spechelper (C0 disambiguation for Enter/Tab/ESC, shift-case restore, function-key symbols).ghostel-send-next-keythrough it, so every key with an encoder representation goes through the terminal's negotiated encoding. Non-ASCII plain characters keep the UTF-8 fallback.ghostel--send-eventalready did for bound keys.ghostel-send-C-cand friends) intentionally keep sending raw bytes so the tty line discipline acts on them regardless of the child's protocol state.Testing
ghostel--event-key-specdecode contract, C0 bytes through the encoder, non-ASCII UTF-8 fallback; updated the three tests that pinned the old raw-byte behavior.make -j8 allgreen (build, elisp + native tests, lint).