Keep tmux panes' key encoding stable across a detach (issue 13076)
In a tmux integration pane the app's terminal is tmux, but iTerm2 also saw
the app's Kitty keyboard protocol requests in the pane output and acted on
them. tmux cannot restore that state after a detach, so keys such as
Shift-Enter were encoded one way before a detach and another way after.
- Ignore the pane's Kitty keyboard requests in tmux mode, and treat the
Kitty flags as off for a tmux pane, including any carried in from a
restored arrangement.
- On tmux 3.9 or later (assumed to include tmux PR 5615 with the fixes
requested there), send keystrokes to tmux by name so tmux encodes each
one for the pane's current mode: legacy, modifyOtherKeys, or Kitty.
Keys that the byte path handles before the input method are named
there; everything else is named only after the input method has seen
it. Text, keypad keys and F13 and up keep the byte path, as do the
user-chosen CSI u and raw modes.
- Subscribe to #{pane_key_mode} and show tmux's mode in the Terminal
State menu, disabling toggles that no longer have an effect.
- Parse #{pane_key_mode} with TmuxPaneKeyMode.
Known gap on tmux 3.9: text that is not a keystroke (pastes, snippets,
reports) is still sent through send-keys, so tmux encodes it when the app
uses the Kitty report-all-keys flag. It should be sent with send-keys -H. G
George Nachman committed
8242815bca96d6bb13fe0050ece606c968fc807b
Parent: ed001e0