Scrollback duplication: TUI redraw without alternate screen causes doubled lines
Status Fixed / completed
Maintainer reply None cached
Activity 1 comment · opened Jul 19, 2026 · closed Jul 19, 2026
Description
Claude Code v2.1.215 streams text output into the main screen buffer, then performs a full-screen TUI redraw from cursor home (CUP 1;1) — without ever entering alternate screen mode (DECSET 1049h). This causes lines to appear twice when scrolling back: once from the original streaming output (in scrollback) and once from the TUI redraw (on screen).
Reproduction
- Launch
claude --name "test"inside a terminal that records raw output (or use a ConPTY-based terminal emulator) - Run a command that produces multi-screen output (e.g. a review or analysis task)
- When Claude finishes and redraws the TUI, scroll up
- Lines near the top of the visible screen appear duplicated — they exist both in scrollback (from streaming) and on screen (from the TUI redraw)
Raw data analysis
Captured via .rtrec session recording in a ConPTY-based terminal emulator:
- No
DECSET 1049h(alternate screen) anywhere in the entire session — confirmed by searching all output records - At completion, Claude sends a large record streaming the full output via
CR LF(content scrolls into scrollback normally) - Immediately followed by two consecutive cursor-home redraws (
CUP 1;1+ full screen content), slightly different from each other (off by one row), in the same main buffer - The last line of a wrapped paragraph ends up in scrollback from the streaming output AND at the top of the visible screen from the redraw
Expected behavior
Claude Code should either:
- Enter alternate screen mode (
DECSET 1049h/DECSET 1047h) for TUI rendering so redraws don't pollute scrollback, or - Avoid re-sending content that's already in the scrollback when doing cursor-home redraws
Environment
- Claude Code v2.1.215
- Windows 11 (ConPTY)
- Terminal: custom ConPTY-based emulator (but the issue is in the escape sequences Claude sends, not in terminal handling)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗