Skip to content

Do not resize the original pane while flash is active - #2

Open
snapwich wants to merge 1 commit into
AndreVicencio:mainfrom
snapwich:fix/pane-resize-on-swap
Open

snapwich wants to merge 1 commit into
AndreVicencio:mainfrom
snapwich:fix/pane-resize-on-swap

Conversation

@snapwich

Copy link
Copy Markdown

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 -d creates the holding window at full window size, not pane size. When the original pane is a split, swap-pane resizes it up and then back:

before flash:  nvim pane 213x75
during flash:  nvim pane 426x75   <- SIGWINCH, nvim re-lays out its splits
after flash:   nvim pane 213x75   <- SIGWINCH again

nvim re-lays out twice in quick succession and does not always repaint cleanly.

2. No client redraw on restore. swap-pane repaints 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 with capture-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 -y sets window-size to manual for 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

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>
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.

1 participant