[BUG] Scrollback shows viewport content instead of history after terminal resize

Status Fixed / completed
Maintainer reply None cached
Activity 4 comments · opened Apr 22, 2026 · closed Apr 22, 2026

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_

View original on GitHub ↗

4 Comments

github-actions[bot] · 5 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/51828
  2. https://github.com/anthropics/claude-code/issues/46834

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

cslovell · 5 months ago

Changing to /tui fullscreen made it scrollable again.

cslovell · 5 months ago

Likely duplicate of #46834, with #51828 as an additional same-day report. All three describe SIGWINCH triggering the inline-mode TUI to re-emit content into primary scrollback, making scrollback show current/recent viewport content rather than true earlier history. My variant: in code-server (xterm.js) on Linux with Claude Code v2.1.117, the re-emitted content is specifically the bottom prompt region appearing at the top of scrollback on scroll-up after resize. Adding as an additional data point — same bug class, different environment (Linux / code-server rather than macOS / native Terminal or VS Code) and different session state (mid-response rather than pre-turn or mid-transcript).

Found 2 possible duplicate issues: 1. [[BUG] Scrollback duplication on terminal resize persists in 2.1.116 (VS Code integrated terminal, macOS) #51828](https://github.com/anthropics/claude-code/issues/51828) 2. TUI relayouts (SIGWINCH / permission-mode toggle) spill entire transcript into scrollback as duplicate copies #46834 This issue will be automatically closed as a duplicate in 3 days. If your issue is a duplicate, please close it and 👍 the existing issue instead To prevent auto-closure, add a comment or 👎 this comment 🤖 Generated with Claude Code
github-actions[bot] · 5 months ago

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.