Bash/Fish/Zsh: avoid drawing a new line when Space-Tab completion finds no matches
This commit is contained in:
parent
ed9a035a26
commit
daa5c98112
|
|
@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Zsh: skip doctor diagnostics in non-interactive shells.
|
- Zsh: skip doctor diagnostics in non-interactive shells.
|
||||||
- Zsh: avoid inserting a trailing space when cancelling interactive Space-Tab completions.
|
- Zsh: avoid inserting a trailing space when cancelling interactive Space-Tab completions.
|
||||||
- Bash: avoid blanking the prompt when cancelling interactive Space-Tab completions.
|
- Bash: avoid blanking the prompt when cancelling interactive Space-Tab completions.
|
||||||
|
- Bash/Fish/Zsh: avoid drawing a new line when Space-Tab completion finds no matches.
|
||||||
|
|
||||||
## [0.9.9] - 2026-01-31
|
## [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.
|
# If there is a space after the last word, use interactive selection.
|
||||||
elif [[ -z ${COMP_WORDS[-1]} ]]; then
|
elif [[ -z ${COMP_WORDS[-1]} ]]; then
|
||||||
# shellcheck disable=SC2312
|
# shellcheck disable=SC2312
|
||||||
if __zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")"; then
|
if __zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}" 2>/dev/null)"; then
|
||||||
# In case the terminal does not respond to \e[5n or another
|
# In case the terminal does not respond to \e[5n or another
|
||||||
# mechanism steals the response, it is still worth completing
|
# mechanism steals the response, it is still worth completing
|
||||||
# the directory in the command line.
|
# the directory in the command line.
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ function __zoxide_z_complete
|
||||||
else if test (builtin count $tokens) -eq (builtin count $curr_tokens)
|
else if test (builtin count $tokens) -eq (builtin count $curr_tokens)
|
||||||
# If the last argument is empty, use interactive selection.
|
# If the last argument is empty, use interactive selection.
|
||||||
set -l query $tokens[2..-1]
|
set -l query $tokens[2..-1]
|
||||||
set -l result (command zoxide query --exclude (__zoxide_pwd) --interactive -- $query)
|
set -l result (command zoxide query --exclude (__zoxide_pwd) --interactive -- $query 2>/dev/null)
|
||||||
and __zoxide_cd $result
|
and __zoxide_cd $result
|
||||||
and builtin commandline --function cancel-commandline repaint
|
and builtin commandline --function cancel-commandline repaint
|
||||||
and builtin history append "{{ cmd.unwrap_or("cd") }} "(string escape -- $result) &>/dev/null
|
and builtin history append "{{ cmd.unwrap_or("cd") }} "(string escape -- $result) &>/dev/null
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ if [[ -o zle ]]; then
|
||||||
elif [[ "${words[-1]}" == '' ]]; then
|
elif [[ "${words[-1]}" == '' ]]; then
|
||||||
# Show completions for Space-Tab.
|
# Show completions for Space-Tab.
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" --interactive -- ${words[2,-1]})" || __zoxide_result=''
|
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" --interactive -- ${words[2,-1]} 2>/dev/null)" || __zoxide_result=''
|
||||||
|
|
||||||
# Set a result to ensure completion doesn't re-run
|
# Set a result to ensure completion doesn't re-run
|
||||||
compadd -Q -S "" -- ""
|
compadd -Q -S "" -- ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue