From d92f89e47f8f91e995b5a129a9199bca426e262b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Nov 2022 10:09:25 +0530 Subject: [PATCH] ZSH integration: Report cwd on every new prompt draw Handles the case of a command reporting a different cwd to the terminal. --- shell-integration/zsh/kitty-integration | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell-integration/zsh/kitty-integration b/shell-integration/zsh/kitty-integration index e79b34a94..a9631c2d0 100644 --- a/shell-integration/zsh/kitty-integration +++ b/shell-integration/zsh/kitty-integration @@ -230,6 +230,10 @@ _ksi_deferred_init() { if (( ! opt[(Ie)no-cwd] )); then _ksi_report_pwd() { builtin print -nu $_ksi_fd '\e]7;kitty-shell-cwd://'"$HOST""$PWD"'\a'; } chpwd_functions=(${chpwd_functions[@]} "_ksi_report_pwd") + # An executed program could change cwd and report the changed cwd, so also report cwd at each new prompt + # as in this case chpwd_functions is insufficient. chpwd_functions is still needed for things like: cd x && something + functions[_ksi_precmd]+=" + _ksi_report_pwd" _ksi_report_pwd fi