From 3ec603fc55b47cd96a277c446e85c9e75a80d5c0 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 19 Dec 2025 15:56:02 +0100 Subject: [PATCH] Send OSC 7 on fresh prompt (child may have changed it) After I run a child process like "fish -C 'cd /tmp'", the terminal will have a stale working directory. Let's send the OSC 7 notification also once for every fresh prompt (which is less frequent than the calls to fish_prompt). This is not fully correct, since it will not work for cases like bind ctrl-g 'fish -C "cd /tmp"' which allow running external commands without creating a fresh prompt. We can fix those later, using the code paths for bracketed paste and friends. A minor argument for not fixing this just yet is that some people override "__fish_update_cwd_osc" to work around bugs in their terminal. Closes #12191 Closes #11778 Closes #11777 --- share/functions/__fish_config_interactive.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 1674cc4a0..e77470e15 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -141,7 +141,8 @@ end" >$__fish_config_dir/config.fish # Notify terminals when $PWD changes via OSC 7 (issue #906). if not functions --query __fish_update_cwd_osc - function __fish_update_cwd_osc --on-variable PWD --description 'Notify terminals when $PWD changes' + function __fish_update_cwd_osc --description 'Notify terminals when $PWD might have changed' \ + --on-variable=PWD --on-event=fish_prompt set -l host $hostname # if set -l konsole_version (string match -r -- '^Konsole (\d+)\..*' (status terminal))[2] # # To-do: use a Konsole version where KF6_DEP_VERSION is >= 6.12