google-gemini / google-gemini/gemini-cli
bug(cli): aggressive terminal flickering/tearing during user typing and spinner animations
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 45
Description
### Bug Description
When running the Gemini CLI, fast typing or typing while background sub-agent operations/spinners are active causes aggressive terminal flickering and tearing.
### Steps to Reproduce
1. Start the interactive CLI.
2. Run any command that executes in the background (such as a search or a complex subagent task) or type very fast.
3. Observe the prompt line and the spinner flickering/redrawing constantly.
### Root Cause
This is caused by concurrent rendering contention between `CliSpinner` and `InputPrompt` in the `ink` reconciler. The `CliSpinner` animates its frames very fast, and the `InputPrompt` updates the cursor using `terminalCursorFocus`, which triggers aggressive native cursor toggles (`\x1B[?25l` and `\x1B[?25h`) and ANSI line-clears. Since terminal emulators lack double-buffering, this contention becomes visible as flickering and tearing.
Contributor guide
Research direction
Start by tracing the CliSpinner and InputPrompt components, focusing on their interaction through the ink reconciler and terminalCursorFocus behavior. Reproduce the issue in the interactive CLI with fast typing and an active spinner; done means prompt input and spinner animations render without visible flickering or tearing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100