Skip to content

input(feat[keys]): Add F13-F35 and modifier keys - #212

Merged
tony merged 1 commit into
masterfrom
feat/129-extended-keys
Dec 5, 2026
Merged

tony merged 1 commit into
masterfrom
feat/129-extended-keys

Conversation

@tony

@tony tony commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Add extended function keys (f13–f35) and left/right modifier-only keys (shift_left through meta_right) to libvt.input._encode_key.

Changes

  • Encode f13–f35 as Kitty functional CSI u codepoints 57376–57398 when DISAMBIGUATE, REPORT_EVENT_TYPES, or REPORT_ALL_KEYS is active, and as xterm tilde sequences (25, 26, 28, 29, 31–34, 42–56~) otherwise.
  • Encode shift_left/ctrl_left/alt_left/super_left/hyper_left/meta_left and their _right counterparts as Kitty 57441–57452 strictly under REPORT_ALL_KEYS, returning b"" otherwise.
  • Verified parity across four independent permissive reference lineages (XTerm, Ghostty, Alacritty, WezTerm) and the Kitty Keyboard Protocol specification.
  • Added unit tests, doctests in docs/topics/protocols-and-input.md, and a CHANGES entry.

Fixes #129

why: Programs enabling Kitty REPORT_ALL_KEYS or binding extended
function keys could not construct or encode f13-f35 or left/right
modifier-only KeyEvent instances without raising ValueError.

what:
- Add canonical f13-f35 mappings (xterm CSI ~ legacy fallback and Kitty
  57376-57398 CSI u when enhanced) and left/right modifier-only keys
  (shift_left through meta_right, emitting Kitty 57441-57452 only under
  REPORT_ALL_KEYS and b"" otherwise) in src/libvt/input.py.
- Add unit tests in tests/test_input.py, doctested docs in
  docs/topics/protocols-and-input.md, and a CHANGES entry.

Fixes #129
@tony
tony merged commit cff951f into master Dec 5, 2026
9 checks passed
@tony
tony deleted the feat/129-extended-keys branch December 5, 2026 18:23
@tony tony mentioned this pull request Dec 5, 2026
35 of 38 tasks

This branch was successfully deployed

1 active deployment
docs — aaa8edc9 Deployed Dec 5, 2026 by tony via build (3.14) #532
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Represent modifier-only keys and extended function keys

1 participant