Skip to content

Preserve Kitty keyboard event metadata - #27

Open
robinvd wants to merge 4 commits into
helix-editor:masterfrom
robinvd:wasbeer-key-metadata
Open

robinvd wants to merge 4 commits into
helix-editor:masterfrom
robinvd:wasbeer-key-metadata

Conversation

@robinvd

@robinvd robinvd commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • preserve canonical, shifted, and base-layout keys from Kitty CSI-u events
  • expose associated text without clearing Shift or replacing the canonical key
  • validate full modifier/event fields, including encoded mask 256
  • parse all keyboard enhancement report flags
  • initialize enhancement metadata on Unix and Windows event paths

Motivation

Terminal multiplexers need both physical key identity and generated text to re-encode input faithfully. The current parser replaces the canonical key with the shifted key, clears Shift, and drops base-layout and associated-text fields, which makes combinations such as Shift+1 impossible to forward correctly.

Validation

  • cargo test
  • cargo clippy --all-targets -- -D warnings
  • cargo check --target x86_64-pc-windows-gnu --features windows-legacy

KeyEvent is no longer Copy because associated text is variable-length; this is an intentional API change.

@the-mikedavis

Copy link
Copy Markdown
Member

Dropping Copy is unfortunate but I don't see a way around it, maybe other than limiting the associated text to a fixed-size buffer and truncating larger inputs. But that doesn't really seem reasonable.

Is the idea to use this for something like Zellij?

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.

2 participants