mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
Restyle detection of terminals that support OSC 7
We detect one terminal (foot) with a "string match" command, and all others in a long "test" command. Let's put the detection of each terminal on a new line. This should be easier to read and change. It also allows to lose one level of indentation.
This commit is contained in:
parent
065b769c1d
commit
348a5b6baf
1 changed files with 12 additions and 9 deletions
|
@ -257,8 +257,12 @@ function __fish_config_interactive -d "Initializations that should be performed
|
||||||
# Notify terminals when $PWD changes (issue #906).
|
# Notify terminals when $PWD changes (issue #906).
|
||||||
# VTE based terminals, Terminal.app, iTerm.app (TODO), and foot support this.
|
# VTE based terminals, Terminal.app, iTerm.app (TODO), and foot support this.
|
||||||
if not set -q FISH_UNIT_TESTS_RUNNING
|
if not set -q FISH_UNIT_TESTS_RUNNING
|
||||||
if string match -q -- 'foot*' $TERM
|
and begin
|
||||||
or test 0"$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = Apple_Terminal -a (string match -r '\d+' 0"$TERM_PROGRAM_VERSION") -ge 309 -o "$TERM_PROGRAM" = WezTerm
|
string match -q -- 'foot*' $TERM
|
||||||
|
or test 0"$VTE_VERSION" -ge 3405
|
||||||
|
or test "$TERM_PROGRAM" = Apple_Terminal && test (string match -r '\d+' 0"$TERM_PROGRAM_VERSION") -ge 309
|
||||||
|
or test "$TERM_PROGRAM" = WezTerm
|
||||||
|
end
|
||||||
function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes'
|
function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes'
|
||||||
if status --is-command-substitution || set -q INSIDE_EMACS
|
if status --is-command-substitution || set -q INSIDE_EMACS
|
||||||
return
|
return
|
||||||
|
@ -267,7 +271,6 @@ function __fish_config_interactive -d "Initializations that should be performed
|
||||||
end
|
end
|
||||||
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
|
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
# Create empty configuration directores if they do not already exist
|
# Create empty configuration directores if they do not already exist
|
||||||
test -e $__fish_config_dir/completions/ -a -e $__fish_config_dir/conf.d/ -a -e $__fish_config_dir/functions/ ||
|
test -e $__fish_config_dir/completions/ -a -e $__fish_config_dir/conf.d/ -a -e $__fish_config_dir/functions/ ||
|
||||||
|
|
Loading…
Reference in a new issue