From 2c8bc05826bc44f67a0a0b9163da2f55ec0f6453 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Mon, 19 Sep 2016 18:40:44 -0700 Subject: [PATCH] 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 --- share/functions/__fish_config_interactive.fish | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index b1f18588e..691593379 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -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