feat(ui): enable "TerminalBuffer" mode to solve flicker#24512
Conversation
|
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! |
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 introduces a significant update to the terminal rendering architecture by adding support for a new terminal buffer mode. These changes aim to improve rendering performance and stability, particularly when handling complex terminal output. Additionally, the PR includes various UI enhancements, updated keyboard shortcuts for better usability, and dependency updates to fix existing bugs. 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 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 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. Footnotes
|
|
Size Change: +12.7 kB (+0.04%) Total Size: 34.7 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new terminal buffer architecture and an Ink-based render process to improve UI performance and capabilities. Key features include the addition of a toggleable mouse mode (Ctrl+S), session recording (F6/F7), and frame snapshots (F8). Keyboard shortcuts were updated, notably moving copy mode to F9. The VirtualizedList component was refactored to support static rendering and backbuffer overflow. Feedback identifies a regression where ANSI arrays are no longer rendered in standard terminal mode, a logic error in the renderStatic condition within VirtualizedList, and a suggestion to use loose equality checks for optional exit codes to correctly handle undefined values.
jacob314
left a comment
There was a problem hiding this comment.
Thanks for the PR! I've updated the PR description and title to match the Conventional Commits format.
I also pushed a small fix directly to the branch to resolve a strict React guideline violation where a side effect (appEvents.emit) was occurring inside the setMouseMode state setter callback within AppContainer.tsx.
One minor note: The useAlternateBuffer hook now returns true if either the alternate buffer or the terminal buffer is enabled. This makes the hook name slightly misleading (as evidenced by its usage as isAlternateBufferOrTerminalBuffer in MainContent.tsx). It's not a blocker, but you might consider renaming it to useAlternateOrTerminalBuffer or splitting them in a future PR for clarity.
Looks good to go!
98d50b9 to
dcd0c8e
Compare
| this.useRipgrep = params.useRipgrep ?? true; | ||
| this.useBackgroundColor = params.useBackgroundColor ?? true; | ||
| this.useAlternateBuffer = params.useAlternateBuffer ?? false; | ||
| this.useTerminalBuffer = params.useTerminalBuffer ?? false; |
There was a problem hiding this comment.
In schemas/settings.schema.json line 468, terminalBuffer is declared with default true. In this service initialization block, it fallbacks to false. should we align?
There was a problem hiding this comment.
aligned. in the near feature will run lints to fix these to all be non-nullable. in practice we are never passing in null but we have just messed up our types.
There was a problem hiding this comment.
instead of spawning a new JSX wrapper inside renderItem, should we fetch a cached/pre-existing list element reference to avoid instance recreation?
There was a problem hiding this comment.
good call out. fixed.
239062f to
7707bd5
Compare
test: update test utils and resolve snapshot differences for ink changes feat: refactor VirtualizedList to support static rendering and terminal buffers feat: wire up AppContainer mouse mode and recording state for ink buffer Fix stale ref in ScrollProvider breaking scrolling. The ScrollProvider was getting stuck with a stale reference because the `scrollables` Map was being registered and unregistered whenever the entry identity changed. The underlying `ScrollableList` component dynamically created a new ID which caused React remount cycles, while the `ScrollProvider` itself suffered from state lag where the event handler ref was one tick behind the actual registration. This commit resolves these issues by: 1. Adding a stable `id` and `key` to `ScrollableList` in `MainContent.tsx` 2. Making `scrollablesRef` synchronously update in `ScrollProvider.tsx` 3. Using a proxy entry in `useScrollable` to avoid constant re-registering. chore: add useEffect cleanup for ResizeObservers Checkpoint fixing terminal buffer support. Termina Serializer Optimization CHECKPOINT_BS_NOT_FOR_COMMIT Setting schema stuff missed earlier. Tool Result display fixes. Checkpoint no commit. Checkpoint of compile fixes feat: Auto-scroll to bottom via Events feat: Auto-scroll to bottom on exiting mouse mode Fix snapshots Update ink version to fix terminal worker launching bug. List fixes. fix(ui): remove side effect from setState in AppContainer
03c383f to
571866a
Compare
99eef17 to
3b99d8c
Compare
This PR introduces a new
TerminalBufferrendering mode to resolve UI flicker issues experienced in the traditional alternate buffer mode.Key Changes
TerminalBufferfor a smooth, flicker-free rendering experience by leveraging static rendering for history items.renderProcessandterminalBufferconfiguration options to customize the rendering strategy.Motivation
The standard Ink alternate buffer mode relies on full-screen rewrites which causes flicker, especially on slower terminal emulators.
TerminalBufferseparates static content (chat history) from dynamic elements (input prompt, spinners), drastically reducing the screen area that needs redrawing.Fixed Issues