Skip to content

Conversation

@scidomino
Copy link
Collaborator

@scidomino scidomino commented Jan 21, 2026

Summary

Support command/ctrl/alt backspace correctly

Details

The bulk of this PR is devoted to distinguishing between alt and cmd which we previously did not. This also reorgs code to always sort shift, alt, ctrl, cmd in that order (matching the kitty code order)

Related Issues

Fixes #16791

How to Validate

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @scidomino, 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 accuracy and consistency of keyboard shortcut handling by introducing a clear distinction between the 'Alt' and 'Meta' modifier keys. This refactoring involves updating the underlying key event parsing, modifying the keybinding configuration structure, and adjusting all relevant default shortcuts and documentation. The change ensures that the application responds precisely to 'Alt' and 'Meta' key presses, which is particularly important for users on macOS where the 'Option' key (Alt) and 'Command' key (Meta) serve different functions.

Highlights

  • Refactored Key Modifier Handling: Introduced distinct 'alt' and 'meta' boolean properties in the Key interface and keybinding configurations, replacing a previously conflated 'command' property. This allows for more precise control over key combinations.
  • Improved Keypress Parsing Logic: Updated the KeypressContext to accurately parse and differentiate 'Alt' and 'Meta' modifiers from raw terminal input sequences, ensuring correct recognition of user input.
  • Updated Default Keybindings and Documentation: Modified numerous default keybindings and the keyboard shortcuts documentation to correctly utilize the new 'alt' and 'meta' properties, enhancing cross-platform consistency and clarity for users.
  • Comprehensive Test Suite Updates: Synchronized extensive test suites across various components to validate the new 'Alt' and 'Meta' key distinctions, ensuring the robustness and correctness of the keybinding system.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the keyboard shortcut handling to properly distinguish between Alt and Meta (Command) keys, which is a significant improvement for cross-platform consistency and accuracy. The changes involve updating the KeyBinding interface, modifying the key parsing logic in KeypressContext, and adjusting key matching in keyMatchers. Corresponding documentation and test files have also been updated to reflect these distinctions. Overall, the changes are well-implemented and address a crucial aspect of keyboard input handling.

@github-actions
Copy link

github-actions bot commented Jan 21, 2026

Size Change: -12 B (0%)

Total Size: 23.2 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23.2 MB -12 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Jan 21, 2026
@scidomino scidomino force-pushed the tomm_alt_meta branch 3 times, most recently from 30ebb2d to 4276f88 Compare January 21, 2026 04:11
@scidomino scidomino changed the title Distinguish between alt and meta Support command/ctrl/alt backspace correctly Jan 21, 2026
@scidomino scidomino marked this pull request as ready for review January 21, 2026 04:34
@scidomino scidomino requested review from a team as code owners January 21, 2026 04:34
@scidomino scidomino force-pushed the tomm_alt_meta branch 5 times, most recently from 68821db to 035ba3e Compare January 21, 2026 11:37
@scidomino
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great refactoring to properly distinguish between alt and cmd modifier keys, which were previously conflated. The changes are extensive and touch upon keybinding definitions, parsing logic, tests, and documentation. The code is now much clearer. I found one minor issue where the alt key was not being checked in the vim input handler, which could lead to incorrect behavior for Alt+Enter. Other than that, the changes look solid.

@scidomino
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly refactors the key handling logic to distinguish between alt and cmd modifiers, which were previously conflated. This is a significant improvement for correctness and clarity. The changes are consistently applied across the key binding definitions, the key press event parsing logic, and all related tests and components. The code is now more explicit and easier to understand. I've reviewed the changes and found no issues. Great work!

name: 'a',
sequence: 'a',
ctrl: false,
shift: false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: all these calls were verbose and they are even more verbose now. should we modify the core helper so all the modifiers are optional rather than required parameters defaulting to false to make these tests more terse?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The issue is we have no core helper. Will do that in a follow up.

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

@scidomino scidomino enabled auto-merge January 21, 2026 17:52
@scidomino scidomino added this pull request to the merge queue Jan 21, 2026
Merged via the queue into main with commit f190b87 Jan 21, 2026
25 checks passed
@scidomino scidomino deleted the tomm_alt_meta branch January 21, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support command/ctrl/alt backspace correctly

2 participants