fix: decode the BS byte as backspace - #149
Merged
Merged
Conversation
xterm sends 0x08 for Backspace unless backarrowKey is turned off, but the parser only treated DEL as backspace and folded 0x08 into the Ctrl+letter range as ctrl+h. TextArea and TextInput drop unrecognised ctrl keys, so the key did nothing in the text editor example. 0x08 now decodes to a plain backspace, and Kitty keycode 8 is accepted alongside 127. The cost is that a legacy encoding cannot tell Backspace and Ctrl+H apart, so Ctrl+H is only bindable under the Kitty protocol, which reports it as CSI 104;5u. Fixes #146
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.
Fixes #146.
Backspace did nothing in the text editor on xterm. xterm sends
0x08for Backspace unlessbackarrowKeyis turned off, but the parser only treated DEL as backspace and folded0x08into the Ctrl+letter range, so it arrived asctrl+h.TextAreaandTextInputreturn early on any ctrl key they don't recognise, so the event was dropped. Same reason Ctrl+D and Ctrl+Q kept working while Backspace and Ctrl+H did not.0x08now decodes to a plain backspace, and Kitty keycode 8 is accepted alongside 127.The tradeoff: a legacy encoding cannot tell Backspace and Ctrl+H apart, they are the same byte. So Ctrl+H is only bindable under the Kitty protocol, which reports it separately as
CSI 104;5u. There is a test pinning that. crossterm and vaxis make the same call, and nothing in this repo binds Ctrl+H.Verified by driving the built binaries through a pty with
TERM=xterm-256color, sending the exact bytes xterm sends. Showcase, tab 5, typingABCthen two backspaces:zig buildandzig build testpass.