tide: ask the terminal from inside tmux too
The OSC 11 query opted out under tmux on the assumption it would need the \ePtmux; passthrough wrapper. It does not, and that assumption cost the fix precisely where it was wanted: ssh'd into a box inside tmux. tmux answers OSC 11 from a pane itself, out of the background it queried from the outer terminal, and it re-queries when that terminal reports a colour scheme change -- so the value tracks the real window rather than going stale at tmux start. Measured on tmux 3.7b, the version on both ends: a pane's query is answered without ever reaching the outer terminal, and after a colour scheme notification the next query returns the new background. No tmux configuration is required. Passthrough is the wrong tool here and stays unused: it is output-only, so the outer terminal's reply goes to tmux rather than to the pane, and a wrapped query returns nothing at all. screen keeps opting out -- untested rather than known broken, and there the caller falls back to the config files as before. The live pty suite gains a remote-tmux scenario: config files all dark, terminal reporting light, the whole thing inside tmux. It fails with the opt-out restored.
This commit is contained in:
parent
af52fcf7a3
commit
513ec573b1
@ -9,11 +9,16 @@ function __tide_terminal_osc_background \
|
||||
status is-interactive
|
||||
or return 1
|
||||
|
||||
# tmux and screen both need the query wrapped, and each wants it wrapped
|
||||
# differently. Leave those to the caller's config-file path instead of
|
||||
# guessing wrong and eating the user's keystrokes waiting for a reply.
|
||||
set -q TMUX
|
||||
and return 1
|
||||
# tmux needs no special handling: it answers OSC 11 from a pane itself, out
|
||||
# of the background it queried from the outer terminal, and it re-queries
|
||||
# when that terminal reports a colour scheme change -- so the answer tracks
|
||||
# the real window. Do not reach for the \ePtmux; passthrough wrapper here:
|
||||
# that is output-only, the reply goes to tmux rather than to this pane, and
|
||||
# the query then times out having achieved nothing.
|
||||
#
|
||||
# screen is left out because it is untested rather than known broken; there
|
||||
# the caller falls back to reading the config files, as it did everywhere
|
||||
# before this query existed.
|
||||
string match -q 'screen*' -- "$TERM"
|
||||
and return 1
|
||||
|
||||
|
||||
@ -18,9 +18,17 @@ set path_label "direct"
|
||||
set through_tmux 0
|
||||
set mode [expr {[llength $argv] > 0 ? [lindex $argv 0] : "direct"}]
|
||||
|
||||
if {$mode eq "tmux"} {
|
||||
set path_label "tmux"
|
||||
if {$mode eq "tmux" || $mode eq "remote-tmux"} {
|
||||
set path_label $mode
|
||||
set through_tmux 1
|
||||
if {$mode eq "remote-tmux"} {
|
||||
# The ssh-inside-tmux case. tmux answers OSC 11 from a pane out of the
|
||||
# background it holds for the outer terminal, so the query works here
|
||||
# with no wrapping -- but only if nothing opts out of asking.
|
||||
set kitty_config [file join $fixtures kitty-remote-dark]
|
||||
set light_reply "ebeb/e8e8/e4e4"
|
||||
set light_segment "DFDCD8"
|
||||
}
|
||||
spawn env TERM=xterm-kitty KITTY_CONFIG_DIRECTORY=$kitty_config \
|
||||
tmux -L tide-appearance-test \
|
||||
-f "$env(HOME)/.tmux.conf" new-session fish --interactive
|
||||
|
||||
Loading…
Reference in New Issue
Block a user