daemon, docs: send xterm's legacy bytes for Ctrl+Space, Ctrl+digit and Alt+Shift #163

Merged
natsukium merged 1 commit from daemon/legacy-ctrl-keys into main 2026-10-18 13:44:06 +09:00
Owner

The legacy encoder disagreed with xterm and kitty on Ctrl+Space (0x20 instead of 0x00), Ctrl+Backspace (0x7f instead of 0x08), Ctrl+2…8 / Ctrl+/ / Ctrl+? (text instead of C0 bytes) and Alt+Shift+letter (lowercased after ESC). This sends xterm's bytes for those keys.

  • The digit, / and ? rows go in a separate legacy table, so modifyOtherKeys level 1 still escapes Ctrl+digit as before.
  • Keys that the Kitty or modifyOtherKeys modes leave unescaped fall through to the legacy encoder and get the corrected bytes there too, as in kitty.
  • key-encoding.md now lists the legacy Ctrl/Alt mapping. Its Kitty bit-1 and level-1 sentences now say which keys each mode escapes; the old wording did not match the code for Ctrl+C under bit 1.

Closes #157

The legacy encoder disagreed with xterm and kitty on Ctrl+Space (`0x20` instead of `0x00`), Ctrl+Backspace (`0x7f` instead of `0x08`), Ctrl+2…8 / Ctrl+/ / Ctrl+? (text instead of C0 bytes) and Alt+Shift+letter (lowercased after `ESC`). This sends xterm's bytes for those keys. - The digit, `/` and `?` rows go in a separate legacy table, so modifyOtherKeys level 1 still escapes Ctrl+digit as before. - Keys that the Kitty or modifyOtherKeys modes leave unescaped fall through to the legacy encoder and get the corrected bytes there too, as in kitty. - `key-encoding.md` now lists the legacy Ctrl/Alt mapping. Its Kitty bit-1 and level-1 sentences now say which keys each mode escapes; the old wording did not match the code for Ctrl+C under bit 1. Closes #157
daemon, docs: send xterm's legacy bytes for Ctrl+Space, Ctrl+digit and Alt+Shift
Some checks failed
darwin / detect relevant changes (pull_request) Successful in 8s
darwin / darwin docs-only no-op (pull_request) Has been skipped
windows / detect relevant changes (pull_request) Successful in 23s
windows / windows docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m10s
bench / instruction-count regression gate (pull_request) Has been cancelled
pr / nix flake check (pull_request) Has been cancelled
pr / cargo build / clippy / test / deny (pull_request) Has been cancelled
pr / wire schema is compatible with the base (pull_request) Has been cancelled
pr / frontend smoke (x86_64-linux) (pull_request) Has been cancelled
windows / cargo clippy (Windows cross) (pull_request) Has been cancelled
windows / frontend smoke (Windows) (pull_request) Has been cancelled
windows / cargo nextest (Windows) (pull_request) Has been cancelled
7d674a9644
The legacy encoder is the GUI's default path, and it disagreed with xterm
and kitty on keys that editors and shells bind: Emacs C-SPC received a
plain space, readline could not tell M-B from M-b, and a shell's
Ctrl+Backspace word delete got DEL. Ctrl on Space and Backspace was lost
because the named-key branch returned the bare byte first, the Alt prefix
reused the Kitty keycode helper whose lowercasing the Kitty spec requires
but xterm does not, and the Ctrl table lacked Xlib's digit, `/` and `?`
rows.

The digit rows live in a separate legacy table rather than in ctrl_byte:
modifyOtherKeys level 1 reads ctrl_byte as its "leave alone" set, and its
escaped output for Ctrl+digit is meant to stay as it is. Keys that the
Kitty or modifyOtherKeys modes do not escape fall through to the legacy
encoder, so they take the corrected bytes too, as they do in kitty.

The key-encoding reference now lists the legacy Ctrl and Alt mapping, and
its Kitty bit-1 and level-1 sentences state which keys each mode escapes
instead of resting on "has a legacy byte", which the new table makes
untrue for Ctrl+digit and which never matched bit 1's escaping of Ctrl+C.

Assisted-by: Claude Code
natsukium force-pushed daemon/legacy-ctrl-keys from 7d674a9644
Some checks failed
darwin / detect relevant changes (pull_request) Successful in 8s
darwin / darwin docs-only no-op (pull_request) Has been skipped
windows / detect relevant changes (pull_request) Successful in 23s
windows / windows docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m10s
bench / instruction-count regression gate (pull_request) Has been cancelled
pr / nix flake check (pull_request) Has been cancelled
pr / cargo build / clippy / test / deny (pull_request) Has been cancelled
pr / wire schema is compatible with the base (pull_request) Has been cancelled
pr / frontend smoke (x86_64-linux) (pull_request) Has been cancelled
windows / cargo clippy (Windows cross) (pull_request) Has been cancelled
windows / frontend smoke (Windows) (pull_request) Has been cancelled
windows / cargo nextest (Windows) (pull_request) Has been cancelled
to f96dc9cff4
All checks were successful
darwin / detect relevant changes (pull_request) Successful in 8s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 1m9s
bench / instruction-count regression gate (pull_request) Successful in 56s
pr / nix flake check (pull_request) Successful in 1m5s
pr / cargo build / clippy / test / deny (pull_request) Successful in 2m4s
pr / wire schema is compatible with the base (pull_request) Successful in 3s
windows / detect relevant changes (pull_request) Successful in 16s
windows / windows docs-only no-op (pull_request) Has been skipped
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 34s
windows / cargo clippy (Windows cross) (pull_request) Successful in 18s
windows / cargo nextest (Windows) (pull_request) Successful in 4m13s
windows / frontend smoke (Windows) (pull_request) Successful in 2m36s
2026-10-18 13:18:28 +09:00
Compare
natsukium scheduled this pull request to auto merge when all checks succeed 2026-10-18 13:20:09 +09:00
natsukium deleted branch daemon/legacy-ctrl-keys 2026-10-18 13:44:06 +09:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
felis-terminal/felis!163
No description provided.