Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@srivatsj
Copy link
Contributor

@srivatsj srivatsj commented Oct 8, 2025

Enhanced keyboard input processing to support:

  • Alt+letter Unicode mappings for macOS terminals (iTerm2) that send Unicode characters instead of escape sequences
  • ESC+character Alt handling for VS Code terminal compatibility
  • Kitty protocol support for letter keys with all modifiers (not just Ctrl)
  • Proper arrow key handling with Kitty protocol enabled

Added comprehensive test coverage for all new keyboard input scenarios

fixes: #10753

TLDR

Dive Deeper

Reviewer Test Plan

Testing Matrix

🍏 🪟 🐧
npm run
npx
Docker
Podman - -
Seatbelt - -

Linked issues / bugs

@google-cla
Copy link

google-cla bot commented Oct 8, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good. Some of these comments are mainly questions. For keyboard support we have to be extremely careful and do absolutely the minimum rather than letting the logic get too complex.

@srivatsj srivatsj marked this pull request as ready for review October 9, 2025 20:23
@srivatsj srivatsj requested a review from a team as a code owner October 9, 2025 20:23
…al-keys.txt with:

  - 4 terminals (iTerm2, Ghostty, MacTerminal, VSCodeTerminal)
  - 3 keys (a, o, m) with Alt modifier
Fixed the implementation - Updated KeypressContext.tsx to handle Alt+letter in kitty protocol by changing one condition from ctrl && to (ctrl || alt)
- Add comprehensive map for all Alt+A through Alt+Z combinations
- Convert accented characters (å, ø, µ, ¥, etc.) to proper Alt+letter events
- Fix Alt+Y handling for both backslash (\) and yen (¥) symbols
// Map of accented characters to their corresponding Alt+letter combinations
// These are sent by iTerm2/VSCode terminals when pressing Alt+letter, but with meta:false
const ACCENTED_CHAR_TO_LETTER: Record<string, string> = {
å: 'a', // Alt+A
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these comments. and rename this to alt or meta key map rather than accented char to letter. That way the name describes what this is not what it looks like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after this last minor nit is addressed.

π: 'p',
œ: 'q',
'®': 'r',
ß: 's',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why aren't some of these chars in quotes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier seems to be removing the single code for some unicode characters so using Unicode escape codes

Copy link
Collaborator

@jacob314 jacob314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jacob314 jacob314 enabled auto-merge October 13, 2025 02:24
@jacob314 jacob314 added this pull request to the merge queue Oct 13, 2025
Merged via the queue into google-gemini:main with commit 87f175b Oct 13, 2025
19 checks passed
jacob314 added a commit that referenced this pull request Oct 13, 2025
thacio added a commit to thacio/auditaria that referenced this pull request Oct 13, 2025
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 Alt+key combinations

2 participants