[BUG] Scrollback shows viewport content instead of history after terminal resize
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
In VS Code Server (code-server, running in Onyxia), running Claude Code in the integrated terminal produces corrupted scrollback after a window resize. Plain output (seq 1 500) scrolls back correctly after resize — the bug only reproduces with Claude Code, which suggests it's specific to Claude Code's use of cursor-positioning and in-place line-rewrite ANSI sequences interacting with xterm.js's reflow-on-resize logic, rather than a generic xterm.js scrollback bug.
To reproduce:
Open VS Code Server terminal, launch claude.
Ask a question that produces output longer than the viewport.
Resize the browser window (or the terminal panel).
Scroll up in the terminal.
Expected: scrollback shows the actual earlier response text.
Actual: scrollback shows content from the current viewport — in particular, the bottom prompt region reappears at the top as you scroll, as if the buffer is cycling visible rows rather than revealing hidden history.
Does not reproduce with seq 1 500 under identical resize conditions.
Initially, before scroll:
<img width="579" height="417" alt="Image" src="https://github.com/user-attachments/assets/d5219acc-85cb-47d6-bc9c-d7c0223ed8c0" />
After scrolling up to see hidden text:
<img width="600" height="447" alt="Image" src="https://github.com/user-attachments/assets/8d56a79a-c5d7-44aa-9fcb-dccd4ea7daa3" />
About the code server version:
code-server
code-server: v4.109.2
Code: 1.109.2
Commit: 9184b645cc7aa41b750e2f2ef956f2896512dd84
Date: 2026-02-11T18:00:45.918Z (2 mos ago)
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
claude-code: v2.1.117
What Should Happen?
Scrollback shows the actual earlier response text.
Error Messages/Logs
Steps to Reproduce
To reproduce:
Open VS Code Server terminal, launch claude.
Ask a question that produces output longer than the viewport.
Resize the browser window (or the terminal panel).
Scroll up in the terminal.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.117
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗