Escape spaces correctly in Bash completions

This commit is contained in:
Ajeet D'Souza 2022-06-25 17:05:35 +05:30
parent c7400cf0ed
commit 162956990a
2 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bash/Fish/Posix/Zsh: paths on Cygwin.
- Fish: completions not working on certain systems.
- Bash: completions not escaping spaces correctly.
## [0.8.1] - 2021-04-23

View File

@ -134,12 +134,12 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER
\builtin local result
# shellcheck disable=SC2312
result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -i -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" &&
COMPREPLY=("${__zoxide_z_prefix}${result@Q}")
COMPREPLY=("${__zoxide_z_prefix}${result}/")
\builtin printf '\e[5n'
fi
}
\builtin complete -F __zoxide_z_complete -o nospace -- {{cmd}}
\builtin complete -F __zoxide_z_complete -o filenames -- {{cmd}}
\builtin complete -r {{cmd}}i &>/dev/null || \builtin true
fi