Terminal scrolls to top on every new output in certain sessions
Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 13 comments · opened Mar 15, 2026 · closed Apr 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator)
responded on this thread — see the highlighted reply below.
Context
In certain Claude Code sessions, the terminal viewport scrolls to the very top of the screen every time Claude produces additional output. This makes it difficult to follow the conversation as the user must constantly scroll back down to see the latest output.
Acceptance Criteria
- Sessions no longer auto-scroll to the top when new output is rendered
- Terminal viewport stays pinned to the bottom (latest output) as content is appended
- Fix applies across common terminal emulators on Windows (Windows Terminal, etc.)
Implementation Notes
- Bug appears to be session-specific — not all sessions exhibit the behavior
- Reported on Windows 11 (10.0.26200)
- Root cause may relate to how terminal escape sequences or cursor positioning are handled during streaming output
13 Comments
Root cause traced in cli.js v2.1.76 source: Ink's rendering uses \ on every re-render. When output is large, the cursor moves far up in the buffer and Windows Terminal (and iTerm) follows the cursor, snapping the viewport to the top. Full analysis in #34794.
Updated PR #34798 with v2 fix: stateful stdout.write interceptor that clamps cursor-up across ALL writes (not just sync blocks). Catches Ink renderer, prompt renderer, and all other cursor-up sources. Patch + PowerShell script included.
Updated PR #34798 with 3 combined patches: (1) stateful stdout.write interceptor clamping cursor-up, (2) render throttle 16ms→200ms, (3) disable synchronized update mode. All three are needed — cursor-up clamping alone does not fix it because Windows Terminal exits scroll mode on ANY stdout write, and sync blocks batch writes into one viewport-resetting update. PowerShell apply/revert script included.
v3 update: Previous fixes (cursor-up clamping, disabling sync update) did not work and caused flickering.
Root cause identified: Windows Terminal bug microsoft/terminal#14774 —
SetConsoleCursorPositionalways scrolls viewport to cursor, even when visible. Every Ink re-render triggers this. Cannot be fixed from within the process.v3 patch: render throttle
SK6=16→SK6=1000(1fps). Gives 1 second of uninterrupted reading between viewport resets. Trade-off: streaming text in ~1s chunks. No flickering.PR #34798 updated. Real fix needs Microsoft (terminal#14774) or Anthropic (PTY proxy/append-only rendering).
v5 update: Fundamentally different approach — buffer ALL Ink renders during active work, screen stays frozen (no viewport jumping). Flush only when (a) user types (at prompt/bottom, safe to update) or (b) 5s of no renders (Claude finished). Previous v1-v4 failed because WT bug microsoft/terminal#14774 triggers viewport scroll on ANY cursor positioning. v5 avoids this by not writing to stdout at all during active work. Trade-off: no spinner/progress visible during work. PR #34798 updated.
v6: Buffer ALL renders, flush ONLY on user input (stdin). No timer. No auto-flush. Zero viewport jumping while not at bottom. Root cause: WT bug microsoft/terminal#14774. PR #34798.
v7: Replay ALL buffered frames on flush (fixes v6 outdated screens). Keeps entire diff chain so screen content is always correct. Still zero viewport jumping — flush only on user input (stdin). PR #34798.
Final fix: Ctrl+6 freeze toggle. Press Ctrl+6 to freeze screen (buffer renders, scroll freely). Press again to unfreeze (replay + live output). Tab title shows [FROZEN]. Root cause is WT bug microsoft/terminal#14774 — cannot be detected/fixed automatically. PR #34798.
try
### iTerm2 Global Settings
AppleScrollAnimationEnabled = 0
NSScrollAnimationEnabled = False
NSScrollViewShouldScrollUnderTitlebar = False
### iTerm2 tmux Profile (scroll-related)
| Setting | Value |
|---------|-------|
| Scroll To Bottom On Output |
False|| Scrollback Lines |
3000|| Scrollback in Alternate Screen |
False|| Scrollback With Status Bar |
False|| Allow Alternate Mouse Scroll |
True|| Mouse Reporting |
False|| Disable Window Resizing |
True|### tmux Config (
~/.config/.tmux.conf)```bash
set -g alternate-screen off # let iTerm2 handle screen switching
# set -ga terminal-overrides ',xterm*:smcup@:rmcup@' # disabled
A fix is available as a Claude Code plugin: scroll-fix
Install:
Root cause: both Ink renderer AND readline/prompt system emit cursor-up sequences exceeding viewport height. The plugin clamps all cursor-up per write call. Also includes Ctrl+6 freeze toggle.
PR: https://github.com/anthropics/claude-code/pull/35683
thanks for creating this, i get an error when i run the command however:
/plugin marketplace add cruzlauroiii/claude-code
⎿ Error: The name 'claude-code-plugins' is reserved for official Anthropic marketplaces. Only
repositories from 'github.com/anthropics/' can use this name.
This was fixed in v2.1.81 — The terminal viewport on Windows Terminal no longer jumps to the top on every new line of output. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.