Bash: avoid blanking the prompt when cancelling interactive completions
This commit is contained in:
parent
e4b82c0598
commit
a97f239292
|
|
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- PowerShell: use fully qualified names when invoking cmdlets.
|
||||
- Bash/Fish/POSIX/Zsh: resolve symlinks on Windows.
|
||||
- Zsh: avoid inserting a trailing space when cancelling interactive Space-Tab completions.
|
||||
- Bash: redraw the prompt instead of blanking it when cancelling interactive Space-Tab completions.
|
||||
|
||||
## [0.9.9] - 2026-01-31
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER
|
|||
# If there is a space after the last word, use interactive selection.
|
||||
elif [[ -z ${COMP_WORDS[-1]} ]]; then
|
||||
# shellcheck disable=SC2312
|
||||
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" && {
|
||||
if __zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")"; then
|
||||
# In case the terminal does not respond to \e[5n or another
|
||||
# mechanism steals the response, it is still worth completing
|
||||
# the directory in the command line.
|
||||
|
|
@ -189,7 +189,12 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER
|
|||
# builtin "bind".
|
||||
bind -x '"\e[0n": __zoxide_z_complete_helper'
|
||||
\builtin printf '\e[5n' >/dev/tty
|
||||
}
|
||||
else
|
||||
# The interactive selection was cancelled. fzf has drawn over
|
||||
# the prompt, so redraw the current line.
|
||||
bind '"\e[0n": redraw-current-line'
|
||||
\builtin printf '\e[5n' >/dev/tty
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue