Scrolling snaps to top during streaming output in iTerm2
Description
When reading output in a Claude Code CLI session and scrolling up while text is streaming, the viewport snaps to the top/beginning of the window. This makes it impossible to review earlier output during an active session.
Environment
- Terminal: iTerm2 (latest, macOS Sequoia)
- Claude Code version: 2.1.87
- macOS: Darwin 24.6.0 (Apple Silicon)
- Also tested with:
tmux -CC(iTerm2 native integration) — same behavior
Steps to Reproduce
- Start a Claude Code session in iTerm2
- Send a prompt that generates a long response
- While text is streaming, scroll up to read earlier output
- Viewport immediately snaps away from your scroll position
What I Expected
Scroll position should remain stable while reading, even during streaming output — similar to how most terminal applications handle scrollback.
What Actually Happens
Scrolling up during streaming causes the viewport to snap to the top of the buffer, making it impossible to read earlier output until streaming completes.
Attempted Workarounds (none resolved it)
tmux -CCwith iTerm2 native integration- iTerm2 Advanced → "Prevent CSI 3 J from clearing scrollback history" → Yes
- iTerm2 Advanced → "Save scroll buffer when clearing screen" → Yes
- Various other iTerm2 scroll-related advanced settings
Root Cause Hypothesis
Ink (React-based terminal renderer) appears to redraw the entire viewport on each token, which disrupts the terminal's scroll position. This may require changes to how Ink manages the terminal buffer during streaming.
Workaround
Plain tmux (not -CC) with Ctrl-B [ scroll mode partially works but is cumbersome.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗