Skip to content

Fix flicker showing message to press ctrl-O again to collapse.#20414

Queued
jacob314 wants to merge 5 commits intomainfrom
output_expand
Queued

Fix flicker showing message to press ctrl-O again to collapse.#20414
jacob314 wants to merge 5 commits intomainfrom
output_expand

Conversation

@jacob314
Copy link
Contributor

@jacob314 jacob314 commented Feb 26, 2026

Summary

Code review feedback for crl-O to expand support as a PR

How to repro: press ctrl-O in regular and alternate buffer mode. Verify the expected messages show and disappear in the expected amount of time.
Fixes #20413

@jacob314 jacob314 requested a review from a team as a code owner February 26, 2026 09:10
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 26, 2026

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
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 addresses a visual flicker in the UI by refactoring how temporary messages are displayed. It consolidates the logic for timed messages into a dedicated custom hook, which streamlines state management and timer handling, leading to a more stable and predictable user experience for transient UI elements.

Highlights

  • Refactored Timed Message Logic: The manual state and timer management for displaying temporary messages, such as the 'press Ctrl-O to collapse' hint, has been replaced with a centralized useTimedMessage hook. This change simplifies the component logic and reduces the likelihood of display issues.
  • Flicker Fix: The primary goal of this refactoring was to eliminate a flicker that occurred when showing the 'press Ctrl-O again to collapse' message, by ensuring consistent and controlled display timing.
  • Improved useTimedMessage Hook: The useTimedMessage hook was enhanced to properly handle null messages, allowing for explicit clearing of a message without inadvertently setting a new timer.
Changelog
  • packages/cli/src/ui/AppContainer.tsx
    • Replaced useState and useRef for showIsExpandableHint with useTimedMessage hook.
    • Simplified the useEffect responsible for triggering and clearing the expandable hint.
    • Updated all call sites that previously set showIsExpandableHint or cleared expandHintTimerRef to use the new triggerExpandHint function.
    • Removed a redundant useEffect for queueErrorMessage as its timing is now managed by useTimedMessage.
  • packages/cli/src/ui/hooks/useTimedMessage.ts
    • Modified the showMessage callback to accept null as a message, allowing for explicit clearing of the message and preventing a timer from being set when the message is cleared.
Activity
  • No specific activity has been recorded for this pull request yet.
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
Copy link

You already have 7 pull requests open. Please work on getting existing PRs merged before opening more.

@github-actions github-actions bot closed this Feb 26, 2026
@jacob314 jacob314 requested a review from jwhelangoog February 26, 2026 09:11
@gemini-cli gemini-cli bot reopened this Feb 26, 2026
@gemini-cli
Copy link
Contributor

gemini-cli bot commented Feb 26, 2026

Thank you for linking an issue! This pull request has been automatically reopened.

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 solid refactoring that replaces manual timer management for UI messages with a new useTimedMessage hook. This change successfully addresses a flickering issue with the overflow hint and improves code clarity by centralizing the logic. I've added a couple of suggestions to further refine the usage of the new hook, ensuring the code's behavior perfectly matches the intent described in the comments and improving efficiency.

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

Size Change: -1.48 kB (-0.01%)

Total Size: 25.7 MB

Filename Size Change
./bundle/gemini.js 25.2 MB -1.48 kB (-0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB

compressed-size-action

@gemini-cli gemini-cli bot added area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 26, 2026
@jwhelangoog
Copy link
Contributor

This comment contains automated feedback from /review-frontend and additional comments from Jarrod based on manual testing.

PR Review for #20414

Summary:
The PR refactors the expansion hint logic to use the useTimedMessage hook, which significantly cleans up AppContainer.tsx. There is one logic detail regarding the new hook's implementation that should be adjusted to avoid unnecessary timers, and a note on ASB behavior.

1. Possible Unnecessary Timer in AppContainer.tsx
In several places (e.g., lines 1230 and 1302), triggerExpandHint(false) is called with the intent to hide the hint and clear the timer.

  • Issue: The updated useTimedMessage hook checks if (msg !== null) before starting a timer. Since false is not null, calling triggerExpandHint(false) will clear the current timer but immediately start a new timer to set the state to null after the duration.
  • Fix: Change these calls to triggerExpandHint(null). This will clear the message and the timer without starting a new one, correctly fulfilling the intent described in the code comments (e.g., "Explicitly hide the expansion hint and clear its x-second timer").

2. Behavior in Alternate Screen Buffer (ASB)
This change will now show the Ctrl+O hint within the Composer even while in ASB. This was originally unintended (and the previous logic to suppress it was likely the primary cause of the flicker being addressed). Given the changes discussed in issue #20455, this concern may be temporary, but a notable side effect of this fix.

jacob314 and others added 3 commits February 26, 2026 11:36
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Contributor

@jwhelangoog jwhelangoog left a comment

Choose a reason for hiding this comment

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

thanks Jacob

@jacob314 jacob314 added this pull request to the merge queue Feb 27, 2026
Any commits made after this event will not be merged.
@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
Any commits made after this event will not be merged.
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Message to press ctrl-O to collapse shows for 1ms and disappears in alternate buffer mode

2 participants