summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshley Bartlett <ashley.bartlett@gmail.com>2024-04-13 07:00:59 +1000
committerGitHub <noreply@github.com>2024-04-13 02:30:59 +0530
commit5d8a7ea7b2f41b8cb9eeed05ae3ff56209a3882b (patch)
treeae9cad9307c9d06b49599186c7aa7b98c9d6cf51
parent36f440f3e3e3bae3771f297a95f6f6a88bbf389e (diff)
fix: Space-Tab interactive completions repeating (#785)
-rw-r--r--CHANGELOG.md2
-rw-r--r--templates/zsh.txt6
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8431635..06351ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- zsh: Space-Tab completion repeating output multiple times when matching single
+ directory
- fish: detect infinite loop when using `alias cd=z`.
- fish / Nushell / PowerShell: handle queries that look like args (e.g. `z -x`).
diff --git a/templates/zsh.txt b/templates/zsh.txt
index b574f38..d110154 100644
--- a/templates/zsh.txt
+++ b/templates/zsh.txt
@@ -104,9 +104,12 @@ if [[ -o zle ]]; then
# shellcheck disable=SC2086
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" --interactive -- ${words[2,-1]})" || __zoxide_result=''
+ # Set a result to ensure completion doesn't re-run
+ compadd -Q ""
+
# Bind '\e[0n' to helper function.
\builtin bindkey '\e[0n' '__zoxide_z_complete_helper'
- # Send '\e[0n' to console input.
+ # Sends query device status code, which results in a '\e[0n' being sent to console input.
\builtin printf '\e[5n'
fi
@@ -119,6 +122,7 @@ if [[ -o zle ]]; then
if [[ -n "${__zoxide_result}" ]]; then
# shellcheck disable=SC2034,SC2296
BUFFER="{{ cmd }} ${(q-)__zoxide_result}"
+ __zoxide_result=''
\builtin zle reset-prompt
\builtin zle accept-line
else