claude-code - 💡(How to fix) Fix [BUG] TUI input box leaves ghost renders in scrollback on tmux pane vertical resize [1 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#52660Fetched 2026-04-24 10:43:07
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×5commented ×1

Error Message

⏺ No error messages or stack traces — this is a purely visual rendering artifact. No crash, no exception, no log entries produced.

Claude Code continues functioning normally; only the tmux scrollback buffer is visually corrupted with duplicated input-box and status-line frames captured during pane resize.

Root Cause

The TUI appears to redraw its input box at the new bottom row on each SIGWINCH without clearing the prior render region. Because tmux captures each intermediate frame into scrollback as the pane shrinks, every intermediate input-box position becomes a permanent artifact in history.

Fix Action

Fix / Workaround

Workaround

No workaround preserves scrollback while removing ghosts. Fix must be in the TUI render path.

Code Example

No error messages or stack traces — this is a purely visual rendering artifact. No crash, no
  exception, no log entries produced.

  Claude Code continues functioning normally; only the tmux scrollback buffer is visually
  corrupted with duplicated input-box and status-line frames captured during pane resize.

---

tmux new -s repro \; send-keys 'claude' Enter
  # wait for Claude Code to start, send one prompt, wait for response
  # then in another terminal:
  tmux resize-pane -t repro -U 15
  sleep 1
  tmux resize-pane -t repro -D 15
  tmux attach -t repro
  # Prefix + [ to inspect scrollback
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?

Description

When Claude Code is running inside a tmux pane and the pane is resized vertically (shrunk then expanded, or vice versa), the input box and status line leave ghost copies in tmux scrollback. Expanding the pane back to a larger size reveals multiple stale input-box renders interleaved with actual output, making prior console output unreadable.

The TUI appears to redraw its input box at the new bottom row on each SIGWINCH without clearing the prior render region. Because tmux captures each intermediate frame into scrollback as the pane shrinks, every intermediate input-box position becomes a permanent artifact in history.

Actual behavior

  • Start Claude Code in a tmux pane at some height H.
  • Resize pane smaller (e.g. drag divider up, or Prefix + Up repeatedly).
  • Each intermediate height produces a new input-box render at the new bottom row. Tmux scrolls prior rows into history.
  • Resize pane back to height H (or larger).
  • Visible area now shows multiple stacked input boxes and status lines interleaved with real output. The original output is effectively corrupted in scrollback — cannot be recovered by Ctrl+L because Ctrl+L only redraws the visible screen, not scrollback history.

Reproduces reliably. Does not reproduce for agent output itself — only for the persistent bottom UI elements (input box, status line, footer).

Environment

  • Claude Code: Opus 4.7 (1M context) session, latest CLI
  • OS: macOS Darwin 25.4.0 (Apple Silicon)
  • Terminal: tmux inside [iTerm2 / Ghostty / etc. — fill in]
  • tmux version: [run tmux -V and fill in]
  • Shell: zsh

Impact

  • Scrollback is the primary way to review prior tool output, file reads, and agent reasoning after long sessions. Corruption makes review impossible without restarting the session.
  • Workflow cost: users must avoid resizing panes mid-session, or accept losing scrollback.
  • Especially painful with long-running agents or /loop tasks where scrollback is the only record of intermediate state.

Workaround

  • Ctrl+L redraws the visible screen but does not clean scrollback.
  • tmux Prefix + :clear-history wipes scrollback entirely — removes ghosts but also removes all genuine output.
  • Prefix + z zoom/unzoom produces a single resize event and minimizes ghosts, but does not eliminate them.

No workaround preserves scrollback while removing ghosts. Fix must be in the TUI render path.

Suggested fix

On SIGWINCH, before redrawing the input box / status line at the new bottom row, emit a clear-to-end-of-screen (ESC[J) from the previous input-box start row, or track the previous UI region and explicitly overwrite it with blanks. Alternatively, investigate rendering persistent UI via a dedicated region (e.g. scroll region via ESC[r) so it never enters scrollback.

What Should Happen?

On pane resize, the TUI should either:

  1. Clear the previous input-box region before redrawing at the new position, so scrollback contains only genuine output, or
  2. Render the persistent UI (input box, status line, "auto mode" footer) on an alternate screen buffer / via a mechanism that does not pollute scrollback, while keeping agent output on the main buffer.

Scrollback should contain agent output only — not N copies of the input box captured mid-resize.

Error Messages/Logs

⏺ No error messages or stack traces — this is a purely visual rendering artifact. No crash, no
  exception, no log entries produced.

  Claude Code continues functioning normally; only the tmux scrollback buffer is visually
  corrupted with duplicated input-box and status-line frames captured during pane resize.

Steps to Reproduce

⏺ ## Steps to reproduce

  1. Open iTerm2 (or any terminal emulator).
  2. Start a tmux session: tmux new -s repro.
  3. Launch Claude Code in the tmux pane: claude.
  4. Send a few prompts to generate enough output to fill the visible pane and push content into scrollback (e.g. ls -la /usr, cat some-long-file.md).
  5. While Claude Code is idle at the input prompt, resize the tmux pane vertically smaller:
    • Split an adjacent pane: Prefix + " (horizontal split), or
    • Drag the pane divider up in iTerm2, or
    • Prefix + :resize-pane -U 10
  6. Resize the pane back to the original (or larger) height:
    • Prefix + :resize-pane -D 10, or drag divider back.
  7. Enter tmux copy-mode: Prefix + [, scroll up with PgUp / arrow keys.

Observed: Scrollback contains multiple stacked input-box frames, status lines, and footer renders interleaved with the real agent output from step 4. Each intermediate pane height during the shrink animation produced one ghost render.

Expected: Scrollback shows only the agent output from step 4, with a single (or zero) input-box render at the point of resize.

Minimal reproduction

tmux new -s repro \; send-keys 'claude' Enter
# wait for Claude Code to start, send one prompt, wait for response
# then in another terminal:
tmux resize-pane -t repro -U 15
sleep 1
tmux resize-pane -t repro -D 15
tmux attach -t repro
# Prefix + [ to inspect scrollback

Reproduces on every resize cycle. Ghost count scales with number of intermediate frames rendered during the resize animation.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.118 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

No response

extent analysis

TL;DR

The issue can be fixed by modifying the TUI render path to clear the previous input-box region before redrawing at the new position on SIGWINCH.

Guidance

  • Investigate rendering persistent UI via a dedicated region (e.g., scroll region via ESC[r) to prevent pollution of scrollback.
  • Consider emitting a clear-to-end-of-screen (ESC[J) from the previous input-box start row before redrawing the input box/status line at the new bottom row.
  • Review the TUI rendering code to ensure it properly handles SIGWINCH events and updates the UI without leaving ghost copies in tmux scrollback.
  • Test the fix by reproducing the issue using the provided steps and verifying that scrollback contains only genuine output without ghost copies.

Example

No code snippet is provided as the issue requires modifications to the TUI rendering code, which is not explicitly shown in the issue body.

Notes

The fix may require changes to the Claude Code TUI rendering path, and the exact implementation details are not provided in the issue body. The suggested fix is based on the analysis of the issue and may need to be adapted to the specific codebase.

Recommendation

Apply a workaround by modifying the TUI render path to clear the previous input-box region before redrawing at the new position, as this is the most likely fix based on the issue description.

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