-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
Screen flickers aggressively while Copilot CLI is processing/streaming responses in iTerm2. The flickering occurs across multiple tabs running Copilot CLI and on multiple occasions. It stabilizes after a few minutes but is disruptive and an accessibility concern.
The flickering happens only in Copilot CLI tabs — regular shell tabs in the same iTerm window are unaffected. This rules out an iTerm rendering issue and points to how Copilot CLI handles terminal output.
Affected version
GitHub Copilot CLI 0.0.406
Steps to reproduce the behavior
- Open iTerm2 with multiple tabs
- Run
copilotin one or more tabs - Interact normally — submit prompts and wait for streaming responses
- After a few minutes of use (or with longer session history), the screen starts flickering
- Flickering persists for several minutes before stabilizing
Expected behavior
Terminal output should update smoothly without full-screen flickering. Status indicators and streaming text should use incremental line updates rather than redrawing the entire visible buffer.
Root cause analysis
Binary analysis of the Copilot CLI SEA bundle (Node.js Single Executable Application) shows heavy use of:
clearScreenDown(CSI 0J— erase from cursor to end of display)cursorTo/moveCursor/clearLinefrom Node.js readline
The clearScreenDown approach clears the entire visible region below the cursor and redraws it on every update. During streaming responses, this means the terminal buffer is cleared and repainted potentially hundreds of times per second, causing visible flicker.
Suggested fix: Replace clearScreenDown (CSI 0J) with line-specific erase sequences (CSI 2K per line) to update only the lines that actually changed. This is a well-known terminal rendering issue in CLI tools that use full-region clears instead of incremental updates.
Additional context
- OS: macOS 26.2 (Build 25C56)
- CPU: Apple Silicon (arm64)
- Terminal: iTerm2 3.6.6
- TERM: xterm-256color (configured), xterm-color (in session)
- COLORTERM: truecolor
- Shell: zsh
- Flickering scope: Only Copilot CLI tabs; regular shell tabs unaffected