claude-code - 💡(How to fix) Fix [BUG] Terminal resize causes repeated banner/content duplication in scrollback (per-frame redraw leak) [3 comments, 3 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#49086Fetched 2026-04-17 08:51:17
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×4commented ×3

Root Cause

The TUI redraw on SIGWINCH appears to write the new frame directly into the normal scrollback buffer without first clearing the previous frame. Well-behaved fullscreen TUI apps (vim, htop, etc.) use the alternate screen buffer to isolate redraws from scrollback. Claude Code's renderer either:

  1. Is not using the alternate screen buffer during resize, or
  2. Is switching between alt/normal buffers in a way that leaks each frame into scrollback

Note: CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 does not fix this issue.

RAW_BUFFERClick to expand / collapse

Bug Description

Each terminal resize event (SIGWINCH) triggers a full viewport redraw, but the previous frame is not cleared — it gets pushed into scrollback. When dragging to resize the window horizontally, every intermediate width produces a new copy of the current screen (banner + conversation), flooding scrollback with dozens of near-identical frames at progressively different widths.

This makes it extremely difficult to scroll back through conversation history, as the entire scrollback is filled with duplicate content.

Environment

  • Claude Code: v2.1.110
  • OS: macOS 15.1.1 (Darwin 24.1.0, Apple Silicon)
  • Terminal: macOS Terminal.app (also reproduces in JetBrains Android Studio integrated terminal)
  • Shell: zsh

Steps to Reproduce

  1. Open macOS Terminal.app (or any terminal)
  2. Run claude
  3. Horizontally drag the window edge to make it wider (or narrower)
  4. Scroll up in the terminal

Expected Behavior

  • The viewport should re-render at the new width
  • Scrollback should remain clean — only actual conversation history

Actual Behavior

  • Every intermediate width during the drag produces a full copy of the current screen pushed into scrollback
  • Scrollback fills up with N copies of the banner + current content, each at a slightly different width
  • Actual conversation history becomes unreachable, buried under duplicate frames
  • The more you resize, the more duplicates accumulate

Screenshot

Will attach screenshot in comments showing stacked banners at different widths after a single horizontal resize drag

Root Cause Analysis

The TUI redraw on SIGWINCH appears to write the new frame directly into the normal scrollback buffer without first clearing the previous frame. Well-behaved fullscreen TUI apps (vim, htop, etc.) use the alternate screen buffer to isolate redraws from scrollback. Claude Code's renderer either:

  1. Is not using the alternate screen buffer during resize, or
  2. Is switching between alt/normal buffers in a way that leaks each frame into scrollback

Note: CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 does not fix this issue.

Related Issues

  • #11234 — Repeated re-draw of status text triggered by window resize/monitor switch
  • #6481 — Window resize shenanigans (viewport becomes mirrored duplicate)
  • #18493 — Terminal resize causes content loss
  • #42340 — Terminal scrollback wiped during session
  • #8276 — Text does not reflow when terminal is resized

extent analysis

TL;DR

The issue can be mitigated by modifying the Claude Code renderer to use the alternate screen buffer correctly during window resizes.

Guidance

  • Investigate the Claude Code renderer's handling of the alternate screen buffer during SIGWINCH events to ensure it is not leaking frames into the normal scrollback buffer.
  • Verify that the CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN environment variable is not being overridden or ignored, and try setting it to 0 to force the use of the alternate screen buffer.
  • Review the related issues (#11234, #6481, #18493, #42340, #8276) to see if any of the fixes or workarounds mentioned can be applied to this issue.
  • Consider adding a temporary workaround to clear the scrollback buffer after a resize event, but this may have unintended consequences and should be thoroughly tested.

Example

No code snippet is provided as the issue does not contain enough information about the Claude Code renderer's implementation.

Notes

The root cause analysis suggests that the issue is related to the renderer's use of the alternate screen buffer, but without more information about the implementation, it is difficult to provide a definitive fix. The related issues may provide some clues, but each issue may have its own unique cause and solution.

Recommendation

Apply a workaround by modifying the Claude Code renderer to use the alternate screen buffer correctly during window resizes, as this is the most likely cause of the issue. This may involve updating the renderer to properly switch between the alternate and normal screen buffers during SIGWINCH events.

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