From 1db0ff9f779b9234f3d43684a52850eae1c93bb6 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 4 Sep 2025 08:35:08 +0200 Subject: [PATCH] Allow overriding __fish_update_cwd_osc to work around terminal bugs See #11777 While at it, pull in the TERM=dumb check from master. (cherry picked from commit 898cc3242b15efc9be514538ff97048ed40c2d77) --- share/functions/__fish_config_interactive.fish | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 1b5e4b99e..66da46161 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -219,12 +219,17 @@ end" >$__fish_config_dir/config.fish end # Notify terminals when $PWD changes via OSC 7 (issue #906). - function __fish_update_cwd_osc --on-variable PWD --description 'Notify terminals when $PWD changes' - set -l host $hostname - if set -q KONSOLE_VERSION - set host '' + if not functions --query __fish_update_cwd_osc + function __fish_update_cwd_osc --on-variable PWD --description 'Notify terminals when $PWD changes' + set -l host $hostname + if set -q KONSOLE_VERSION + set host '' + end + if [ "$TERM" = dumb ] + return + end + printf \e\]7\;file://%s%s\a $host (string escape --style=url -- $PWD) end - printf \e\]7\;file://%s%s\a $host (string escape --style=url -- $PWD) end __fish_update_cwd_osc # Run once because we might have already inherited a PWD from an old tab