# Fix: repaint the prompt when exiting without selecting aka adding a fallback

When the interactive picker is canceled without selecting a value, zoxide query --interactive returns no result...... The function had no fallback for this case, so it left the command line in a broken state...
This commit is contained in:
developic 2026-07-04 12:22:07 +05:30 committed by GitHub
parent ad5ea87783
commit 43b8bbcc2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -101,8 +101,13 @@ function __zoxide_z_complete
# If the last argument is empty, use interactive selection.
set -l query $tokens[2..-1]
set -l result (command zoxide query --exclude (__zoxide_pwd) --interactive -- $query 2>/dev/null)
and builtin commandline --replace -- "{{ cmd.unwrap_or("cd") }} "(string escape -- $result)
and builtin commandline --function repaint execute
if test $status -eq 0
builtin commandline --function repaint
return
else
builtin commandline --replace -- "{{ cmd.unwrap_or("cd") }} "(string escape -- $result)
builtin commandline --function repaint execute
end
end
end
complete --command __zoxide_z --no-files --arguments '(__zoxide_z_complete)'