Skip to content

refactor(cli): rename 'return' key to 'enter' internally#21796

Merged
scidomino merged 3 commits intomainfrom
tomm_enter
Mar 10, 2026
Merged

refactor(cli): rename 'return' key to 'enter' internally#21796
scidomino merged 3 commits intomainfrom
tomm_enter

Conversation

@scidomino
Copy link
Copy Markdown
Collaborator

@scidomino scidomino commented Mar 10, 2026

Summary

Renames the internal key name from return to enter

Details

This aligns us with other systems (like VS Code) which will make customizable key bindings easier for users to understand.

Note: We were already calling it "enter" publically so that doesn't change.

Related Issues

Related to #21294

How to Validate

  1. Run npm run typecheck -w packages/cli.
  2. Run npm run test -w packages/cli.
  3. Verify that the Enter key still functions correctly in the interactive CLI (submitting prompts, selecting from lists).

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 10, 2026

Size Change: -97 B (0%)

Total Size: 26.1 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.7 MB -97 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 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-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@scidomino scidomino marked this pull request as ready for review March 10, 2026 02:17
@scidomino scidomino requested a review from a team as a code owner March 10, 2026 02:17
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 refactors the CLI's internal keybinding system by standardizing the name for the 'Enter' key from 'return' to 'enter'. This change is crucial for future compatibility with VS Code-style keybinding configurations, ensuring a more consistent and maintainable codebase for input handling.

Highlights

  • Key Name Renaming: The internal key name 'return' has been consistently renamed to 'enter' across the packages/cli workspace to align with VS Code's canonical naming convention.
  • Keypress Context Update: The KeypressContext.tsx file was updated to ensure that carriage return and related sequences are now correctly identified with the 'enter' key name.
  • Key Binding Definitions: The defaultKeyBindings and VALID_KEYS in keyBindings.ts were migrated to exclusively use 'enter', removing the legacy 'return' definition.
  • UI Component Logic: Explicit checks for key.name === 'return' in various UI components, such as vim.ts, InputPrompt.tsx, and ConfigExtensionDialog.tsx, have been updated to key.name === 'enter'.
  • Key Formatting and Translation: The keybindingUtils.ts file was updated to display 'enter' as 'Enter', and keyToAnsi.ts was adjusted to map 'enter' to the carriage return ANSI sequence.
  • Test Suite Alignment: Approximately 30 unit tests that mock keypresses have been updated to reflect the new 'enter' key name, ensuring test suite consistency.
Changelog
  • packages/cli/src/ui/auth/ApiAuthDialog.test.tsx
    • Updated keyName from 'return' to 'enter' in test cases.
  • packages/cli/src/ui/components/ConfigExtensionDialog.tsx
    • Changed key name checks from 'return' to 'enter' for confirmation and dialog closing logic.
  • packages/cli/src/ui/components/InputPrompt.tsx
    • Updated the isEnterKey check to use 'enter' instead of 'return'.
  • packages/cli/src/ui/components/SessionBrowser.test.tsx
    • Modified triggerKey calls to use 'enter' for simulating Enter key presses.
  • packages/cli/src/ui/components/SessionBrowser.tsx
    • Updated the conditional check for key name from 'return' to 'enter' when selecting sessions.
  • packages/cli/src/ui/components/shared/TextInput.test.tsx
    • Adjusted keypressHandler calls in tests to use 'enter' for key name.
  • packages/cli/src/ui/components/shared/text-buffer.test.ts
    • Updated handleInput calls in tests to use 'enter' for key name.
  • packages/cli/src/ui/contexts/KeypressContext.test.tsx
    • Modified expect.objectContaining for key name from 'return' to 'enter' in various keypress tests.
    • Updated parameterized functional key tests to expect 'enter' instead of 'return'.
  • packages/cli/src/ui/contexts/KeypressContext.tsx
    • Updated KEY_INFO_MAP to map [13u and [57414u sequences to 'enter'.
    • Changed key name checks in bufferFastReturn, bufferBackslashEnter, and emitKeys functions from 'return' to 'enter'.
  • packages/cli/src/ui/hooks/useKeypress.test.tsx
    • Updated the key name from 'return' to 'enter' in the alt+enter identification test.
  • packages/cli/src/ui/hooks/useSelectionList.test.tsx
    • Modified pressKey and press calls in tests to use 'enter' for key presses.
  • packages/cli/src/ui/hooks/vim.ts
    • Updated conditional checks for key name from 'return' to 'enter' in useVim hook logic.
  • packages/cli/src/ui/key/keyBindings.test.ts
    • Adjusted KeyBinding instantiation and assertions to use 'enter' instead of 'return'.
  • packages/cli/src/ui/key/keyBindings.ts
    • Removed 'return' from the VALID_KEYS array.
    • Updated JSDoc for the key property to reflect 'enter' as an example.
    • Changed KeyBinding instantiations in defaultKeyBindings from 'return' to 'enter' for various commands.
  • packages/cli/src/ui/key/keyMatchers.test.ts
    • Updated createKey calls in key matcher tests to use 'enter' for the RETURN, ACCEPT_SUGGESTION, SUBMIT, NEWLINE, and SUBMIT_REVERSE_SEARCH commands.
  • packages/cli/src/ui/key/keyToAnsi.ts
    • Changed the SPECIAL_KEYS mapping from 'return' to 'enter' for the carriage return character.
  • packages/cli/src/ui/key/keybindingUtils.test.ts
    • Updated KeyBinding instantiation from 'return' to 'enter' in display name tests.
  • packages/cli/src/ui/key/keybindingUtils.ts
    • Modified the KEY_NAME_MAP to map 'enter' to 'Enter' for user-friendly display.
  • scripts/tests/generate-keybindings-doc.test.ts
    • Updated the binding key from 'return' to 'enter' in the test for documentation generation.
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.

@scidomino scidomino changed the title refactor(cli): rename 'return' key to 'enter' for VS Code alignment refactor(cli): rename 'return' key to 'enter' Mar 10, 2026
@scidomino scidomino changed the title refactor(cli): rename 'return' key to 'enter' refactor(cli): rename 'return' key to 'enter' internally Mar 10, 2026
Copy link
Copy Markdown
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 comprehensive refactoring that renames the internal key name from 'return' to 'enter' across the packages/cli workspace. The changes are consistent and cover test files, UI components, hooks, and keybinding definitions. This alignment with VS Code's conventions is a good step towards better integration. The changes appear to be well-executed and thorough.

Copy link
Copy Markdown
Contributor

@abhipatel12 abhipatel12 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 added this pull request to the merge queue Mar 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 10, 2026
@scidomino scidomino added this pull request to the merge queue Mar 10, 2026
Merged via the queue into main with commit 14412c3 Mar 10, 2026
31 checks passed
@scidomino scidomino deleted the tomm_enter branch March 10, 2026 02:51
kunal-10-cloud pushed a commit to kunal-10-cloud/gemini-cli that referenced this pull request Mar 12, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
yashodipmore pushed a commit to yashodipmore/geemi-cli that referenced this pull request Mar 21, 2026
SUNDRAM07 pushed a commit to SUNDRAM07/gemini-cli that referenced this pull request Mar 30, 2026
warrenzhu25 pushed a commit to warrenzhu25/gemini-cli that referenced this pull request Apr 9, 2026
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