fix(terminal): replay pane terminal modes on reattach so TUIs keep mouse reporting - #181
Open
Kihsomray wants to merge 1 commit into
Open
fix(terminal): replay pane terminal modes on reattach so TUIs keep mouse reporting#181Kihsomray wants to merge 1 commit into
Kihsomray wants to merge 1 commit into
Conversation
…use reporting A Terminal reattached after a Switch or reload seeds xterm with the pane's content, cursor, and alt-screen state, but not the modes the running TUI set once at startup — so a fresh xterm came up with mouse tracking off and clicks never reached the process. The post-seed SIGWINCH repaint does not help: TUIs redraw on resize but do not re-send DECSET modes. Read tmux's per-pane mode flags (mouse_*_flag, cursor_flag, keypad_*_flag, bracket_paste_flag) in the list-panes -F that already discovers the pane id, and replay the set ones before the captured frame. Comma-separated so a tmux lacking a flag yields an empty field instead of shifting the rest.
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.
Fixes #180
Problem
A Terminal reattached after a Switch or reload gets its content, cursor, and
alt-screen state seeded into the new xterm, but not the terminal modes the
running TUI set once at startup — so the fresh xterm comes up with mouse
tracking off and clicks never reach the process. The post-seed SIGWINCH
repaint (
repaintAfterSeed) doesn't help: TUIs redraw on resize but don'tre-send DECSET modes.
Fix
Read tmux's per-pane mode flags (
mouse_standard/button/all/sgr_flag,cursor_flag,keypad_cursor_flag,keypad_flag,bracket_paste_flag) inthe
list-panes -Fthat already discovers the pane id, and replay the setones into xterm before the captured frame — the same technique iTerm2 uses on
attach (
sources/tmux/TmuxStateParser.m,TmuxWindowOpener.m). Generic:applies to any TUI, nothing app-specific. Comma-separated format so a tmux
lacking a flag yields an empty field instead of shifting the rest.
Verification
modes → frame → CUP) plus the empty-fieldtolerance case; full suite passes (802 tests).
through real
tmux -Ccontrol mode.ADR-0012 decision 5 amended with one paragraph.