fix(keys): match alt across terminal protocols - #991
Open
benvinegar wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR makes Alt/Option bindings consistent across legacy Escape-prefixed, explicit ANSI, and Kitty keyboard events while retaining Kitty’s distinct Meta semantics.
Confidence Score: 5/5The PR appears safe to merge, with the protocol-aware behavior covered across shared matching, extension forwarding, and PTY routing. No actionable correctness, security, compatibility, or repository-rule violation remains; production extension event paths preserve the protocol source, and legacy Alt/Meta overlap is intentional and documented. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Terminal key sequence] --> B[OpenTUI decoder]
B --> C{Protocol source}
C -->|Kitty| D[Preserve distinct Alt and Meta flags]
C -->|Raw / legacy| E[Treat Escape-prefixed Meta shape as Alt-compatible]
D --> F[Shared matchesKeyChord matcher]
E --> F
F --> G[Built-in and extension command routing]
B --> H[toExtensionKeyEvent]
H --> I[Extension keyboard and file-view modes]
I --> F
Reviews (1): Last reviewed commit: "fix(keys): match alt across terminal pro..." | Re-trigger Greptile |
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.
Summary
alt/optionbindings match legacy Escape-prefixed Alt events and explicit ANSI/Kitty Alt eventsmatchesKeyuses the same semanticsTesting
bun test src/extension-api/keys.test.ts src/lib/commandKeys.test.ts src/ui/lib/extensionKeyEvent.test.tsbun test test/pty/key-routing.test.ts --test-name-pattern "alt binding"bun run typecheckbun run lintbun run format:checkbun run deps:checkbun run testbun run test:integrationbun run build:npmbun run check:docsPlatforms
Tested on Linux with decoder-backed legacy, explicit ANSI, and Kitty event fixtures plus a full PTY reproduction. Not manually tested on macOS or Windows.
Known limitation
Legacy terminal input cannot distinguish an Escape-prefixed Alt key from Meta, so
alt+nandmeta+nmay overlap there. Kitty keyboard events remain distinct.Closes #843