mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2025-12-08 15:32:31 +01:00
fix: allow completion strategy to fallback to history
When completion finds no results, unset suggestion to allow the next strategy to run instead of blocking with the original input text.
This commit is contained in:
parent
85919cd1ff
commit
22ffb41e33
2 changed files with 9 additions and 3 deletions
|
|
@ -130,6 +130,9 @@ _zsh_autosuggest_strategy_completion() {
|
||||||
# the second null byte, so trim those off the end.
|
# the second null byte, so trim those off the end.
|
||||||
# See http://www.zsh.org/mla/workers/2015/msg03290.html
|
# See http://www.zsh.org/mla/workers/2015/msg03290.html
|
||||||
suggestion="${${(@0)line}[2]}"
|
suggestion="${${(@0)line}[2]}"
|
||||||
|
|
||||||
|
# If the suggestion is the same as the input, treat it as no suggestion
|
||||||
|
[[ "$suggestion" == "$1" ]] && unset suggestion
|
||||||
} always {
|
} always {
|
||||||
# Destroy the pty
|
# Destroy the pty
|
||||||
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
||||||
|
|
|
||||||
|
|
@ -625,6 +625,9 @@ _zsh_autosuggest_strategy_completion() {
|
||||||
# the second null byte, so trim those off the end.
|
# the second null byte, so trim those off the end.
|
||||||
# See http://www.zsh.org/mla/workers/2015/msg03290.html
|
# See http://www.zsh.org/mla/workers/2015/msg03290.html
|
||||||
suggestion="${${(@0)line}[2]}"
|
suggestion="${${(@0)line}[2]}"
|
||||||
|
|
||||||
|
# If the suggestion is the same as the input, treat it as no suggestion
|
||||||
|
[[ "$suggestion" == "$1" ]] && unset suggestion
|
||||||
} always {
|
} always {
|
||||||
# Destroy the pty
|
# Destroy the pty
|
||||||
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
zpty -d $ZSH_AUTOSUGGEST_COMPLETIONS_PTY_NAME
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue