Skip to content

fix(cli): hide shortcuts hint while model is thinking or the user has typed a prompt + add debounce to avoid flicker#19389

Merged
jacob314 merged 7 commits into
mainfrom
hide_hint
Feb 27, 2026
Merged

fix(cli): hide shortcuts hint while model is thinking or the user has typed a prompt + add debounce to avoid flicker#19389
jacob314 merged 7 commits into
mainfrom
hide_hint

Conversation

@jacob314

@jacob314 jacob314 commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Summary

New behavior in alternate buffer mode:
https://screencast.googleplex.com/cast/NjYzMDg0OTEwNDU3NjUxMnw2MGQyYjgyNC1kMg

Demo of undesired bounce when not in alternate buffer mode:
https://screencast.googleplex.com/cast/NjczNjYzMzg4MDY0MTUzNnwxYjgwYWQxOS0zNQ

To repro:
Verify the hint now properly goes away when the model is thinking and goes away when the input prompt is not empty.
Verify that there is no flicker of the hint showing up when you press enter when the input prompt is small.
Fixes #19386

@jacob314 jacob314 requested a review from a team as a code owner February 18, 2026 08:56
@gemini-cli

gemini-cli Bot commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Hi @jacob314, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@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 enhances the user experience of the CLI composer by intelligently managing the visibility of the shortcuts hint. By hiding the hint when the model is processing or when the input buffer contains text, and by introducing a debounce for its appearance, the UI becomes less distracting and more responsive to user interaction, leading to a cleaner and more intuitive interface.

Highlights

  • Improved UI Clarity: The shortcuts hint is now hidden when the AI model is actively responding or when the user has already started typing, reducing visual clutter.
  • Debounced Hint Display: A 200ms debounce has been added to the display of the shortcuts hint, preventing it from flickering or appearing prematurely.
  • Enhanced Test Coverage: New tests were introduced to ensure the shortcuts hint correctly hides under the specified conditions.
Changelog
  • packages/cli/src/ui/components/Composer.test.tsx
    • Added tests to verify the shortcuts hint is hidden when the model is responding.
    • Added tests to verify the shortcuts hint is hidden when text is present in the input buffer.
  • packages/cli/src/ui/components/Composer.tsx
    • Implemented logic to determine if the model is idle and the buffer is empty.
    • Introduced a useState and useEffect hook to debounce the showShortcutsHint flag by 200ms.
    • Updated the showShortcutsHint condition to incorporate the new debounced state.
  • packages/cli/src/ui/components/snapshots/Composer.test.tsx.snap
    • Updated the snapshot to reflect the removal of the ShortcutsHint during streaming.
Activity
  • No specific activity (comments, reviews, etc.) was provided in the pull request description.
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.

@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 introduces logic to hide the shortcuts hint while the model is responding or when the input buffer is not empty, and adds a debounce to the hint's appearance. The changes look good and are supported by new tests.

I've found a potential UI flicker bug in the implementation of the debounce logic and provided a suggestion to fix it. This change will also make the hint's appearance more consistent.

Comment on lines +158 to +159
const [showShortcutsHintDebounced, setShowShortcutsHintDebounced] =
useState(canShowShortcutsHint);

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.

high

Initializing showShortcutsHintDebounced with canShowShortcutsHint can lead to a UI flicker.

Here's the scenario:

  1. On initial render, if canShowShortcutsHint is true, the state is initialized to true and the hint is shown immediately.
  2. If the user then performs an action that makes canShowShortcutsHint become false (like typing a character), the component re-renders.
  3. During this re-render, showShortcutsHintDebounced is still true from the previous state, so the hint is incorrectly rendered for one frame.
  4. The useEffect then runs and sets the state to false, triggering another re-render to hide the hint.

This causes a flicker.

By initializing the state to false, you ensure the debounce logic is applied consistently, even on the initial render, and it fixes this flicker bug. This will introduce a 200ms delay before the hint appears for the first time, which is a reasonable trade-off for a smoother user experience.

Suggested change
const [showShortcutsHintDebounced, setShowShortcutsHintDebounced] =
useState(canShowShortcutsHint);
const [showShortcutsHintDebounced, setShowShortcutsHintDebounced] =
useState(false);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

initial render tends to be with an empty prompt so would create more flicker if we did this.

@github-actions

github-actions Bot commented Feb 18, 2026

Copy link
Copy Markdown

Size Change: +610 B (0%)

Total Size: 25.7 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.2 MB +610 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

@jacob314

Copy link
Copy Markdown
Contributor Author

I've pushed up some commits locally to address some strict testing rules. Let me know if you would like me to push my changes up directly.

@jacob314 jacob314 enabled auto-merge February 18, 2026 23:10
@jacob314 jacob314 changed the title fix(cli): hide shortcuts hint while model is thinking in full UI and when text is in buffer + add 200ms debounce fix(cli): hide shortcuts hint while model is thinking or the user has typed a prompt + add debounce to avoid flicker Feb 19, 2026
@jacob314 jacob314 added this pull request to the merge queue Feb 19, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Feb 19, 2026
@jacob314 jacob314 enabled auto-merge February 19, 2026 01:45
@jacob314 jacob314 force-pushed the hide_hint branch 2 times, most recently from ed93f4d to 8ab92a1 Compare February 25, 2026 00:19
@jacob314 jacob314 added this pull request to the merge queue Feb 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
@jacob314 jacob314 added this pull request to the merge queue Feb 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
@jacob314 jacob314 added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 27, 2026
@jacob314 jacob314 added this pull request to the merge queue Feb 27, 2026
Merged via the queue into main with commit ac4d0c2 Feb 27, 2026
27 checks passed
@jacob314 jacob314 deleted the hide_hint branch February 27, 2026 15:46
BryanBradfo pushed a commit to BryanBradfo/gemini-cli that referenced this pull request Mar 5, 2026
liamhelmer pushed a commit to badal-io/gemini-cli that referenced this pull request Mar 12, 2026
warrenzhu25 pushed a commit to warrenzhu25/gemini-cli that referenced this pull request Apr 9, 2026
cocosheng-g pushed a commit that referenced this pull request May 6, 2026
… typed a prompt + add debounce to avoid flicker (#19389)
@sripasg sripasg added the size/m A medium 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

size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

? for shortcuts hint is not hidden when text is typed in the input prompt

4 participants