claude-code - 💡(How to fix) Fix [BUG] Scrollback shows viewport content instead of history after terminal resize [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52124Fetched 2026-04-23 07:36:00
View on GitHub
Comments
3
Participants
2
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×4commented ×3cross-referenced ×2closed ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

extent analysis

TL;DR

The issue can likely be resolved by adjusting how Claude Code handles cursor-positioning and in-place line-rewrite ANSI sequences to better interact with xterm.js's reflow-on-resize logic.

Guidance

  • Investigate Claude Code's use of ANSI escape sequences for cursor positioning and line rewriting to identify potential conflicts with xterm.js.
  • Review xterm.js documentation for reflow-on-resize logic to understand how it handles terminal output during window resizes.
  • Consider implementing a workaround in Claude Code to temporarily disable or adjust ANSI sequence usage during window resizes.
  • Test the issue with different terminal emulators or versions of xterm.js to isolate if the problem is specific to the current setup.

Example

No specific code example can be provided without more details on Claude Code's implementation, but adjusting the handling of ANSI sequences during resize events might look something like tracking resize events and pausing or modifying output accordingly.

Notes

The solution may depend on the specifics of Claude Code's implementation and how it interacts with xterm.js. Further investigation into the codebase and potentially the xterm.js library is necessary.

Recommendation

Apply a workaround to adjust Claude Code's handling of ANSI sequences during window resizes, as this seems to be the most direct path to resolving the issue without waiting for potential fixes in xterm.js or other dependencies.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Scrollback shows viewport content instead of history after terminal resize [3 comments, 2 participants]