Skip to content

fix(tui): repaint transcript on tmux detach/reattach#128

Closed
Fullstop000 wants to merge 1 commit into
masterfrom
worktree-tui-reattach-repaint
Closed

fix(tui): repaint transcript on tmux detach/reattach#128
Fullstop000 wants to merge 1 commit into
masterfrom
worktree-tui-reattach-repaint

Conversation

@Fullstop000
Copy link
Copy Markdown
Owner

Problem

In a tmux/screen session, detaching and reattaching left the TUI blank — the conversation history appeared lost.

Root cause

Since #89 the TUI runs in alternate-screen Viewport::Fullscreen, so the whole transcript lives in app.transcript (in memory), not in the terminal's scrollback. On reattach:

  1. tmux re-sends the window size via TIOCSWINSZSIGWINCH even when the size is unchanged.
  2. crossterm surfaces this as Event::Resize (emitted on every SIGWINCH, no size dedup).
  3. The console loop dropped Event::Resize into _ => {}.
  4. ratatui's autoresize only repaints when the size actually changed, so the diff renderer wrote nothing → the pane tmux reset on reattach stayed blank.

The data was never lost — it just never got redrawn.

Fix

Handle Event::Resize by forcing a full redraw via terminal.clear() (resets the back buffer so the next frame repaints the entire transcript). 4 lines in runner.rs.

Verification

A/B test with the real binary under tmux — render, wipe the alt-screen out-of-band (simulating tmux's reattach reset), deliver a same-size SIGWINCH, re-capture. Signal confirmed delivered to both binaries:

Binary rendered → wiped → after reattach signal
Unfixed (master) ✅ → blank → stays blank
Fixed (this PR) ✅ → blank → restored

cargo build, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace (527 passed) all clean.

Scope note

This fixes the reattach blank only. It does not restore native mouse-copy or terminal-native scrollback — both are separate costs of the alt-screen model (#89 / mouse capture in #125). Those would need an inline-rendering change, tracked separately.

🤖 Generated with Claude Code

A tmux/screen detach->reattach re-sends the window size via TIOCSWINSZ,
which raises SIGWINCH even when the size is unchanged. crossterm surfaces
this as Event::Resize, but the console loop dropped it, and ratatui's
autoresize only repaints when the size actually *changed*. So a same-size
reattach left the alt-screen blank — the in-memory transcript was intact
but never redrawn, so history appeared lost.

Handle Event::Resize by forcing a full redraw via terminal.clear(), which
resets the back buffer so the next frame repaints the whole transcript.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.47%. Comparing base (da202d0) to head (52f217e).

Files with missing lines Patch % Lines
ignis/src/console/runner.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #128      +/-   ##
==========================================
- Coverage   76.47%   76.47%   -0.01%     
==========================================
  Files          66       66              
  Lines       17440    17441       +1     
==========================================
  Hits        13338    13338              
- Misses       4102     4103       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Fullstop000
Copy link
Copy Markdown
Owner Author

Superseded by #131 (inline rendering). With the conversation in the terminal's native scrollback, tmux detach/reattach persistence is inherent — the clear()-on-resize band-aid here is no longer needed. Closing in favor of #131.

@Fullstop000 Fullstop000 closed this Jun 5, 2026
@Fullstop000 Fullstop000 deleted the worktree-tui-reattach-repaint branch June 7, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants