[BUG] Terminal viewport jumps to top on every re-render in WSL2 + Tabby terminal (Windows 11)
Summary
When running Claude Code in WSL2 via Tabby terminal on Windows 11, the terminal viewport involuntarily scrolls to the top of the buffer on every render cycle. This happens continuously during agent execution and makes the tool unusable for longer sessions, forcing users to constantly scroll back down to see current output.
Environment
- Operating System: Windows 11 (latest)
- Terminal Emulator: Tabby (latest version)
- WSL Setup: WSL2 with Ubuntu 22.04 LTS
- Claude Code Version: 2.0.x (latest)
- Node.js: v20+
- Shell: bash (inside WSL)
Steps to Reproduce
- Open Claude Code in WSL via Tabby terminal:
claude - Give Claude Code a multi-step task (e.g., "Search and refactor files in this project")
- While Claude Code is executing tools/commands, observe the terminal behavior
- Try to scroll up to read previous output or earlier responses
- Expected: Scroll position remains stable, allowing user to navigate history
- Actual: Viewport jumps back to the top of the terminal buffer on each re-render cycle
Observed Behavior
- Terminal scrolls to top repeatedly (approximately every 100-200ms during streaming)
- Scroll position is not maintained when user manually scrolls up
- The behavior is frantic and causes visual flickering
- Users must manually scroll to bottom to continue working
- Effect is compounded with larger outputs (search results, file listings, multi-line responses)
Root Cause Analysis
This appears to be related to issue #34794 and similar duplicates. The problem stems from how Ink (React-based terminal rendering) handles cursor positioning on Windows Terminal/Tabby:
- Ink moves cursor to the start of the component area on each re-render
- When output grows large,
eraseLines()moves cursor far up in the buffer - On Windows terminals, this cursor movement causes viewport to follow the cursor to the top
- This behavior differs from macOS terminals and affects Windows-specific terminal emulators
Related Issues
- #34794 - Terminal scrolls to top during agent execution (Windows Terminal + PowerShell)
- #34400 - Scroll position resets to top during agent execution (macOS/iTerm)
- #34503 - Terminal scrolls to top on every new output in certain sessions
- #34845 - Terminal randomly scrolls to top and auto-scrolls to bottom
- #36816 - Terminal keeps scrolling to top of conversation during active session
Potential Solutions (from issue discussions)
- Alternate Screen Buffer: Use ANSI escape sequences
\x1b[?1049hto prevent viewport interference - Incremental Rendering: Only re-render changed lines instead of entire component
- Scroll Position Detection: Detect if user has scrolled away from bottom and suppress cursor movement
Impact
- Makes Claude Code essentially unusable in WSL2 + Tabby setup for anything beyond very short tasks
- Significantly worse experience compared to competitors (OpenCode, Cursor) which don't exhibit this issue
- Affects any Windows developer using WSL as their primary development environment with third-party terminal emulators
Additional Context
The issue is specific to Windows Terminal behavior with how Ink positions the cursor. This doesn't occur or is minimal on:
- macOS Terminal.app
- iTerm2
- Linux terminals
- PowerShell with certain configurations
However, it severely impacts Windows 11 developers, particularly those using WSL2 for development (a common and recommended setup).
Workarounds Attempted
- Running /clear between tasks (reduces but doesn't eliminate the issue)
- Zooming terminal view
- Expanding panel size
- None of these are reliable or persistent solutions
Request
Please prioritize a fix for this issue, particularly for Windows Terminal behavior. The alternate screen buffer or incremental rendering approach would likely resolve this for Windows users.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗