[Bug] TUI re-renders leak into scrollback causing duplicate fragments with large terminal buffers
Bug Description
Environment
- Claude Code v2.1.111, Opus 4.7 (1M context), max effort
- macOS Terminal.app (built-in)
- Darwin 24.5.0
---
Issue 1 — Raising Terminal.app scrollback limit causes scrollback pollution
What I did:
1. macOS Terminal was truncating my session — I couldn't scroll back to see
the start of my Claude Code conversation. That's bad behavior for a terminal:
I should be able to read my full session history.
2. Went to Terminal → Settings → Profiles → [profile] → Window → "Limit to N
rows" and raised it to 1,000,000 so the full session would be preserved. This
is what the setting is for.
3. Ran Claude Code normally.
4. When I scrolled back, the scrollback was full of tens of thousands of
duplicated fragments of the same turns — same bash output, same file reads,
same assistant text, randomly cut and stacked on top of each other. The
session became unreadable.
The user is trapped:
- Keep default scrollback (~10K) → terminal truncates, can't read full session
- Raise scrollback so full session is preserved → scrollback becomes garbage
Either way, the user loses the ability to review their own Claude Code
session. At ~10K rows the problem is hidden because duplicates get evicted
before they pile up — but that's not a fix, it's just concealment.
Root cause (likely): Claude Code's TUI re-renders (input box refreshes, token
streaming, spinner updates, resize events) leak into scrollback instead of
staying in the live render region. Thousands of re-renders with no eviction =
buffer full of duplicate fragments.
Expected: each turn lands in scrollback once, cleanly, regardless of how large
the user sets scrollback.
Actual: raising scrollback linearly scales the pollution.
Suggested fix: use the alternate screen buffer for the live TUI region so
redraws never touch scrollback. Only finalized transcript lines should be
committed to history. Then users can set scrollback as large as they want and
still read their sessions.
---
Issue 2 — Paste preview truncation hides pasted content from the user
In newer Claude Code versions, pasting a large block into the input shows only
the first few lines + … N lines go after that + last few lines. The model
receives the full paste, but…
Note: Content was truncated.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗