Skip to content

input(feat[kitty]): Add alternate keys and text (#30) - #54

Merged
tony merged 1 commit into
masterfrom
feat/kitty-alt-assoc-keys
Nov 28, 2026
Merged

tony merged 1 commit into
masterfrom
feat/kitty-alt-assoc-keys

Conversation

@tony

@tony tony commented Nov 28, 2026

Copy link
Copy Markdown
Member

Closes #30 (depends on #53)

Summary

Implements Kitty Keyboard Protocol flags REPORT_ALTERNATE_KEYS (4) and REPORT_ASSOCIATED_TEXT (16) in KeyEvent and encode_input() (CSI key[:shifted[:base]] ; [mods[:event]] ; [text-codepoints] u).

What changed

  • libvt.input.KeyEvent: add optional single-character shifted_key and base_key fields (ValueError on multi-character strings) and populate US-ASCII shifted_key in KeyEvent.parse("shift+...").
  • libvt.input.encode_input: emit :shifted (when KeyMod.SHIFT is active and distinct from base_cp) and :base subparameters under REPORT_ALTERNATE_KEYS, emit :-joined UTF-32 associated text codepoints on non-release events under REPORT_ASSOCIATED_TEXT, reject C0/C1/UTF-16 surrogate codepoints, and avoid promoting standalone >4u / >16u legacy keys to CSI u unless DISAMBIGUATE (1) or REPORT_ALL_KEYS (8) is also active.
  • tests/test_input.py, docs/topics/protocols-and-input.md, and CHANGES: unit tests, doctests, and changelog documentation.

@tony
tony force-pushed the feat/ghostty-oracle-cov branch from 704a6ac to bc4d20b Compare November 28, 2026 20:10
@tony
tony changed the base branch from feat/ghostty-oracle-cov to master November 28, 2026 20:13
why: Kitty keyboard protocol flags REPORT_ALTERNATE_KEYS (4) and
REPORT_ASSOCIATED_TEXT (16) require shifted/base-layout key subparameters
and UTF-32 codepoint lists without promoting standalone legacy keys to
CSI u when neither DISAMBIGUATE (1) nor REPORT_ALL_KEYS (8) is active.

what:
- Add optional single-character shifted_key and base_key fields to
  KeyEvent and populate US-ASCII shifted_key in KeyEvent.parse
- Format CSI key[:shifted[:base]] ; [mods[:event]] ; [text-codepoints] u
  sequences in encode_input, rejecting non-printable and surrogate scalars
- Document and doctest Kitty alternate-key encoding in CHANGES and
  docs/topics/protocols-and-input.md
@tony
tony force-pushed the feat/kitty-alt-assoc-keys branch from eeea3c5 to 9bd371d Compare November 28, 2026 20:14
@tony
tony merged commit 00e7a46 into master Nov 28, 2026
9 checks passed
@tony
tony deleted the feat/kitty-alt-assoc-keys branch November 28, 2026 20:39
@tony tony mentioned this pull request Nov 28, 2026
21 of 28 tasks

This branch was successfully deployed

1 active deployment
docs — 9bd371d9 Deployed Nov 28, 2026 by tony via build (3.14) #118
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.

Support Kitty keyboard REPORT_ALTERNATE_KEYS (4) and REPORT_ASSOCIATED_TEXT (8)

1 participant