# 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:
parent
ad5ea87783
commit
43b8bbcc2f
|
|
@ -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)'
|
||||
|
|
|
|||
Loading…
Reference in New Issue