notify_on_cmd_finish: Show the actual command that was finished

Fixes #7420
This commit is contained in:
Kovid Goyal
2024-05-09 09:49:26 +05:30
parent c50e38a080
commit 0d68a21be5
9 changed files with 123 additions and 56 deletions

View File

@@ -215,7 +215,9 @@ _ksi_deferred_init() {
# its preexec hook before us, we'll incorrectly mark its output as
# belonging to the command (as if the user typed it into zle) rather
# than command output.
builtin print -nu $_ksi_fd '\e]133;C\a'
builtin print -nu "$_ksi_fd" '\e]133;C;cmdline='
for (( i=0; i<${#1}; i++ )); do builtin print -nu "$_ksi_fd" -f '%x ' "'${1:$i:1}"; done
builtin print -nu "$_ksi_fd" '\a'
(( _ksi_state = 1 ))
}
@@ -401,9 +403,9 @@ _ksi_deferred_init() {
[[ "$arg" != -* && "$arg" != *=* ]] && builtin break # command found
done
if [[ "$is_sudoedit" == "y" ]]; then
builtin command sudo "$@";
else
builtin command sudo TERMINFO="$TERMINFO" "$@";
builtin command sudo "$@";
else
builtin command sudo TERMINFO="$TERMINFO" "$@";
fi
}
fi
@@ -411,8 +413,8 @@ _ksi_deferred_init() {
# Map alt+left/right to move by word if not already mapped. This is expected behavior on macOS and I am tired
# of answering questions about it.
[[ $(builtin bindkey "^[[1;3C") == *" undefined-key" ]] && builtin bindkey "^[[1;3C" "forward-word"
[[ $(builtin bindkey "^[[1;3D") == *" undefined-key" ]] && builtin bindkey "^[[1;3D" "backward-word"
[[ $(builtin bindkey "^[[1;3C") == *" undefined-key" ]] && builtin bindkey "^[[1;3C" "forward-word"
[[ $(builtin bindkey "^[[1;3D") == *" undefined-key" ]] && builtin bindkey "^[[1;3D" "backward-word"
# Unfunction _ksi_deferred_init to save memory. Don't unfunction
# kitty-integration though because decent public functions aren't supposed to