feat(cli): support literal character keybindings and extended Kitty protocol keys#21972
feat(cli): support literal character keybindings and extended Kitty protocol keys#21972
Conversation
|
Size Change: +1.72 kB (+0.01%) Total Size: 26.5 MB
ℹ️ View Unchanged
|
b056d7a to
58f4a56
Compare
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the CLI's keybinding system by introducing support for direct literal character keybindings and integrating comprehensive handling for the Kitty Keyboard Protocol. These changes improve user experience by allowing more intuitive key assignments and expanding compatibility with advanced terminal emulators, providing a richer and more customizable interaction model. Highlights
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly enhances keyboard input handling, particularly for the Kitty Keyboard Protocol (CSI-u sequences). It introduces a new KITTY_CODE_MAP to parse these sequences into specific key names and actions, including support for extended functional keys (F13-F35), various special keys (e.g., capslock, pausebreak), and numpad keys. The emitKeys function was refactored to leverage this new mapping and correctly interpret CSI-u sequences, distinguishing between printable ASCII characters and special key codes. Corresponding test cases have been added to KeypressContext.test.tsx to validate the recognition of these new key sequences. Additionally, the KeyBinding class in keyBindings.ts was updated to refine key validation, separating single-character keys from a new VALID_LONG_KEYS set, which now encompasses the expanded range of supported function and numpad keys.
Summary
Updates the keybinding system and
KeypressContextto support literal character bindings (e.g.,%,@,+) instead of forcing users to useshift+key. It also adds extensive support for the Kitty Keyboard Protocol (CSI-u), including function keys F13-F35, numpad digits (while preserving insertable typing), and various modifier keys.Details
KeypressContextto programmatically handle Kitty protocol function keys, numpad keys, and modifiers.f13-f20sequences.keyBindings.tsto allow any single Unicode character as a valid keybinding (via[...key].length === 1), making it robust for international keyboard layouts.VALID_KEYS.Related Issues
Related to #21294
How to Validate
{"command": "basic.cancel", "key": "%"}) in yourkeybindings.json. Run the app, pressshift+5for%, and verify the command executes.f13throughf35or numpad digits, ensuring they trigger bound commands while numpad numbers correctly type numbers when no command is bound.Pre-Merge Checklist