Conversation
new-window creates the holding window at full window size. When the original pane is a split, swap-pane resized it up to the window size and back again on return. Full-screen TUIs such as nvim re-laid out their splits twice and did not always repaint cleanly, which left the pane garbled after a jump. Size the holding window to the pane before the swap, so the pane keeps its dimensions and never gets a SIGWINCH. Also force a redraw of every client on restore. swap-pane repaints only the region tmux thinks changed, and some terminals (Windows Terminal) were left showing stale cells even though the tmux grid was correct. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Invoking flash on a pane running a full-screen TUI (nvim) leaves the pane garbled after the jump. A plain shell pane is fine.
Two causes:
1. The pane gets resized.
new-window -dcreates the holding window at full window size, not pane size. When the original pane is a split,swap-paneresizes it up and then back:nvim re-lays out twice in quick succession and does not always repaint cleanly.
2. No client redraw on restore.
swap-panerepaints only the region tmux thinks changed. On some terminals (Windows Terminal) the client is left showing stale cells even though the tmux grid is correct — verified withcapture-pane, which comes back byte-identical to the pre-flash content.Fix
Size the holding window to the pane before the swap, so the pane keeps its dimensions and never gets a
SIGWINCH.resize-window -x -ysetswindow-sizetomanualfor that window only, and the window is detached and short-lived, so nothing else is affected.Then force a redraw of every client on the session in
restore().Testing
Measured pane geometry through a full flash cycle, before and after the patch, with nvim in a split pane and in a full-window pane. After the patch the pane stays at its original size for the whole cycle. Also confirmed on the reporter's setup (WSL + Windows Terminal), where the garbling is gone.
Requires tmux >= 2.9 for
resize-window.🤖 Generated with Claude Code