Terminal resize causes massive content duplication in scroll buffer
Summary
When the terminal window is resized horizontally, Claude Code re-renders the entire conversation output for each resize event. Previous renders are not cleared from the scroll buffer, resulting in 10-20+ duplicated copies of the same conversation stacking up.
Steps to Reproduce
- Start a Claude Code session with some output (e.g., run a few tool calls)
- Resize the terminal window horizontally (drag the edge, or snap to different monitor)
- Scroll up
Expected Behavior
Only one copy of the conversation should be visible in the scroll buffer after resize.
Actual Behavior
Each resize event appends a full re-render of the conversation to the main terminal buffer. The scroll buffer fills with near-identical copies that differ only in line-wrapping width. On a multi-monitor setup where window resizing is frequent, this makes the scroll buffer essentially unusable.
Environment
- Claude Code v2.1.86
- Windows 11 Pro (10.0.26100)
- Windows Terminal
- Shell: bash
Possible Solutions
- Alternate screen buffer — use the alternate screen (like vim/htop) so resizes re-render in place without polluting the scroll buffer. Trade-off: scroll history is lost on exit.
- Debounce + clear — debounce resize events and clear the previous render before re-drawing (e.g., ANSI escape
\e[2Jor cursor repositioning). - No re-render on resize — only re-render the active input area, leave historical output as-is in the buffer.
Additional Context
Especially painful on multi-monitor setups (4 monitors in my case) where dragging/snapping windows between screens triggers multiple resize events in rapid succession.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗