Skip OSC 7 inside emacs, let VTE/Terminal do title

these modern terminals both compose a nicer title if we don't try to provide a custom one (no path in title twice, "fish" in title twice) - and the user can configure which components they'd like in their terminal inside the terminal preferences.

Also make test "$VTE_VERSION" -ge .. work once I commit `test` strtoi
fix - the trick is to add a zero before it so the numeric comparison
works even if it's empty.

Fixes #107
This commit is contained in:
Aaron Gyes 2016-09-19 18:40:44 -07:00
parent 8b1625be2b
commit 2c8bc05826

View file

@ -213,17 +213,19 @@ function __fish_config_interactive -d "Initializations that should be performed
# Load key bindings
__fish_reload_key_bindings
# Repaint screen when window changes size
function __fish_winch_handler --on-signal WINCH
function __fish_winch_handler --on-signal WINCH -d "Repaint screen when window changes size"
commandline -f repaint
end
# Notify terminals when $PWD changes (issue #906)
if test "$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = "Apple_Terminal"
function __update_cwd_osc --on-variable PWD --description 'Notify VTE of change to $PWD'
# VTE and Terminal.app support this in practice.
if test "0$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = "Apple_Terminal"
function fish_title; end
function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes'
status --is-command-substitution
or test -n "$INSIDE_EMACS"
and return
printf \e\]7\;file://\%s\%s\a (hostname) (pwd | __fish_urlencode)
printf \e\]7\;file://\%s\%s\a (hostname) (echo -n $PWD | __fish_urlencode)
end
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
end