Repository navigation
fix(cli): restore debounced static UI refresh on terminal width changes - #29644
jvargassanchez-dot wants to merge 1 commit into
Conversation
|
📊 PR Size: size/M
|
Summary of ChangesHello, 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 rendering artifacts in the CLI's default inline mode that occur when the terminal window is resized horizontally. By implementing a debounced refresh mechanism, the application now correctly clears wrapped line remnants and remounts the static history region only after the resize operation has stabilized, ensuring a clean UI state. Highlights
Using Gemini Code AssistThe 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
Customization To customize the 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 Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a debouncing mechanism for refreshing the static terminal UI when the terminal width changes. Specifically, in AppContainer.tsx, a new useEffect hook debounces calls to refreshStatic by 100ms upon changes to terminalWidth, while ignoring the initial mount using an isInitialMount ref. Additionally, corresponding unit tests have been added in AppContainer.test.tsx to verify that refreshStatic is correctly debounced on width changes and ignores height-only changes. There are no review comments, and I have no feedback to provide.
Summary
Restores the debounced
refreshStatic()effect onterminalWidthchanges inAppContainer.tsx(using a 100ms debounce) so that horizontal terminal resize events in default inline rendering mode clear wrapped frame remnants (ansiEscapes.clearTerminal) and remount the<Static>history region at the updated column width.Details
packages/cli/src/ui/AppContainer.tsx:ui.useAlternateBuffer: falseandui.terminalBuffer: false), narrowing the terminal width causes full-width lines in the dynamicComposerregion (────,▄▄▄▄,▀▀▀▀) to soft-wrap across multiple physical terminal rows. Because Ink'slog-updaterenderer erasespreviousLineCountlogical lines rather than the wrapped physical row count, the top portion of the previous dynamic frame remains in scrollback during resize events.isInitialMount(useRef(true)) and a 100ms debounceduseEffectwatching[terminalWidth, refreshStatic]to clear the terminal and incrementhistoryRemountKeyonce horizontal resizing settles.terminalWidth(excludingterminalHeight) so vertical-only terminal dimension changes (such as mobile virtual keyboard toggles) do not trigger<Static>remounts.packages/cli/src/ui/AppContainer.test.tsx:AppContainerskipsrefreshStatic()on initial mount and on height-only dimension changes, debounces rapidterminalWidthupdates by 100ms, and writesansiEscapes.clearTerminalwhile incrementinghistoryRemountKeyin default inline mode.Related Issues
How to Validate
AppContainerunit test suite:npm test -w @google/gemini-cli -- src/ui/AppContainer.test.tsxPre-Merge Checklist