Skip to content

fix(ui): avoid triggering autocomplete when navigating history - #15948

Closed
jacob314 wants to merge 2 commits into
mainfrom
history_navigation
Closed

fix(ui): avoid triggering autocomplete when navigating history#15948
jacob314 wants to merge 2 commits into
mainfrom
history_navigation

Conversation

@jacob314

@jacob314 jacob314 commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix issue where autocomplete would trigger while navigating up and down breaking navigation.
Also reduce friction navigating through large prompts in the history by defaulting to the first line in the prompt when navigating up and last line when navigating down so that a single up or down keystroke will get to the next prompt.

Details

  • Autocomplete Suppression: Implemented a mechanism to suppress command completion (autocomplete) when a user navigates through input history using Up/Down arrow keys or Ctrl+P/N. This prevents irrelevant suggestions from appearing during history browsing.
  • Cursor Positioning on History Navigation: Enhanced the setText functionality in the text buffer to allow specifying the cursor's position ('start' or 'end') when setting new text. This ensures that when navigating history, the cursor is appropriately placed at the beginning or end of the retrieved command.
  • Completion Re-activation: Completion is automatically re-enabled once the user performs any action other than history navigation, such as typing or manually moving the cursor, providing a seamless transition back to active completion.
  • Test Coverage: Added comprehensive tests to validate the new history navigation and completion suppression logic, including cursor positioning and the correct activation/deactivation of command completion.

Related Issues

Addresses the first part of #15951

How to Validate

Navigate up and down in the history. Verify that you no longer get stuck in the autocompletion UI
Verify you are still able to get autocompletions if you type additional text or move the cursor.

@jacob314
jacob314 requested a review from a team as a code owner January 5, 2026 23:47
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jacob314, 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 refines the user interface experience by addressing an interaction conflict between input history navigation and command completion. The changes ensure that when users browse their command history, the autocomplete feature is temporarily disabled, preventing disruptive suggestions. Upon resuming active input, completion is seamlessly re-enabled, leading to a more intuitive and less cluttered command-line interface.

Highlights

  • Autocomplete Suppression: Implemented a mechanism to suppress command completion (autocomplete) when a user navigates through input history using Up/Down arrow keys or Ctrl+P/N. This prevents irrelevant suggestions from appearing during history browsing.
  • Cursor Positioning on History Navigation: Enhanced the setText functionality in the text buffer to allow specifying the cursor's position ('start' or 'end') when setting new text. This ensures that when navigating history, the cursor is appropriately placed at the beginning or end of the retrieved command.
  • Completion Re-activation: Completion is automatically re-enabled once the user performs any action other than history navigation, such as typing or manually moving the cursor, providing a seamless transition back to active completion.
  • Test Coverage: Added comprehensive tests to validate the new history navigation and completion suppression logic, including cursor positioning and the correct activation/deactivation of command completion.
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.

@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

Size Change: +519 B (0%)

Total Size: 22.3 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 22.3 MB +519 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-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 effectively fixes an issue where autocomplete would trigger during history navigation. It achieves this by introducing a state to track history navigation and temporarily disable completions. The implementation is solid, with good test coverage for the new behavior. The refactoring of useCommandCompletion to accept an options object is also a great improvement for code clarity and maintainability. I have one suggestion to further improve maintainability by removing some duplicated logic.

Comment thread packages/cli/src/ui/components/InputPrompt.tsx Outdated
@jacob314
jacob314 force-pushed the history_navigation branch from 2c065d1 to 93d81e6 Compare January 6, 2026 17:06
@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Jan 7, 2026
@jacob314 jacob314 added area/core Issues related to User Interface, OS Support, Core Functionality and removed status/need-issue Pull requests that need to have an associated issue. labels Jan 7, 2026
@jacob314 jacob314 added status/need-issue Pull requests that need to have an associated issue. and removed status/need-issue Pull requests that need to have an associated issue. labels Jan 8, 2026
@gemini-cli gemini-cli Bot added status/need-issue Pull requests that need to have an associated issue. and removed status/need-issue Pull requests that need to have an associated issue. labels Jan 8, 2026
@bdmorgan

Copy link
Copy Markdown
Collaborator

Automatically closing PR as it is older than 7 days and authored by a team member.

@bdmorgan bdmorgan closed this Jan 23, 2026
@jacob314
jacob314 deleted the history_navigation branch February 19, 2026 07:14
@sripasg sripasg added the size/l A large sized PR label Jun 2, 2026
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 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. size/l A large sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants