Repository navigation
remote-tmux: re-read a pane from tmux when its width changes, not only when it grows - #17140
Conversation
tmux rewraps a pane when its width changes either way, but the mirror re-reads tmux's screen only when a pane grows. After a narrowing it keeps its local rewrap, which differs for seeded rows and for prompt lines padded with spaces.
…y when it grows tmux rewraps a pane on any width change. The mirror's own rewrap matches only for lines it saw arrive live: seeded rows carry no wrap information, and capture drops the trailing spaces a shell pads its prompt line with. After a narrowing the two wrapped at different places, so rows and cursor sat off until something redrew them. The repaint that already follows a grow now also follows any width change.
|
All contributors have signed the CLA ✍️ ✅ |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (3)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe tmux pane repaint method now selects existing panes when their width changes or their height increases. Layout publication calls the renamed method. Tests cover width narrowing, height-only shrinking, grid growth, and reconnect recovery. ChangesPane redraw
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No merge-blocking risk is identified in the reviewed change. 🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CI failure attributionCI failed on
Matched log linesNot re-run automatically: Written by |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
|
Merged, thank you @ejc3! :D |
|
Merge receipt for
Labeled |
00f182f Set Claude idle after reentrant stop without work (manaflow-ai#16635) d8ef7e7 Reject unknown and valueless options in cmux hooks setup (manaflow-ai#17183) 46b5f9c remote-tmux: let a failed socket request say what failed (manaflow-ai#17134) e88d636 remote-tmux: re-read a pane from tmux when its width changes, not only when it grows (manaflow-ai#17140) 984baea remote-tmux: close a window emptied by gathering its mirrors into a new one (manaflow-ai#17141) 9c41d59 fix: recover hidden terminal renderer after window attach (manaflow-ai#16548) 70854a5 ci: publish dogfood artifacts from red CI runs (manaflow-ai#17210) db77e58 fix(cli): reject missing notify text values (manaflow-ai#16778) 76ccbfc ci: activate org-member dogfood artifact publisher (manaflow-ai#17206)
Summary
Attach
cmux ssh-tmuxto a session whose pane is wider than the mirror, and the mirror's rows end up at different heights from the pane's. The prompt and the cursor sit a few rows away from where tmux has them, until something redraws the screen. The same happens whenever a mirrored shell pane is made narrower.To reproduce: start a detached session at 120x40, press Enter a few times at a zsh prompt, then attach from a window that gives the pane 93 columns. In my run the mirror's rows were four off.
tmux rewraps a pane's lines when its width changes in either direction. The mirror rewraps its own copy, and that matches only for lines it saw arrive as live output. Rows that came from the initial capture carry no wrap information, and the capture drops the trailing spaces zsh pads its prompt line with, so after a narrowing the two wrap at different places. cmux already re-reads tmux's screen with
capture-paneafter a pane grows. This makes it do the same after any width change. A pane that only got shorter is left alone, because tmux moves whole rows into history there and so does the mirror.Testing
Two tests in
RemoteTmuxPaneSeedTransportTests, run withxcodebuild test-without-building -scheme cmux-unit -only-testing:cmuxTests/RemoteTmuxPaneSeedTransportTests:narrowedPaneIsRepaintedFromTmuxfails, no repaint is queued.paneThatOnlyGotShorterIsNotRepaintedpasses before and after.main at 68bb2f1 does not compile its test target:
RightSidebarTabCustomizationTestsandCloudMachineOrderingTestsfail to build. Both runs left those two files out locally. That change is not in this branch.I also ran it against a live tmux server on a local build that carries this change on top of other branches of mine. A script creates a 120x40 session, presses Enter six times, attaches, waits for the pane size to hold still, and compares the mirror's screen with
capture-pane. Without the fix the rows differed. With it they matched, and ten other attach, resize and reconnect cases still passed.Changelog
Fixed: A remote tmux mirror no longer shows its rows and cursor out of place after a pane is made narrower.
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Fixes the remote tmux mirror showing rows and the cursor out of place after a pane is made narrower.
tmux rewraps a pane when its width changes in either direction, but the mirror only re-read tmux's screen on growth, so after a narrowing it kept its own rewrap. That rewrap mismatched for seeded rows and for prompt lines padded with spaces, leaving rows and the cursor off until something redrew the screen. cmux now repaints the pane from tmux after any width change; a pane that only got shorter is still left alone, since tmux moves whole rows into history there.
Written for commit c9da55a. Summary will update on new commits.
Summary by CodeRabbit