fix(tooltips): improve behaviour when using zsh-autosuggestions

This commit is contained in:
kema-dev 2023-04-12 23:30:44 +02:00 committed by Jan De Dobbeleer
parent 794bd5ea09
commit 94fa70675a

View file

@ -82,7 +82,21 @@ function _posh-tooltip() {
zle .reset-prompt
fi
# https://github.com/zsh-users/zsh-autosuggestions - clear suggestion to avoid keeping it after the newly inserted space
if [[ -n "$(zle -lL autosuggest-clear)" ]]; then
# only if suggestions not disabled (variable not set)
if ! [[ -v _ZSH_AUTOSUGGEST_DISABLED ]]; then
zle autosuggest-clear
fi
fi
zle .self-insert
# https://github.com/zsh-users/zsh-autosuggestions - fetch new suggestion after the space
if [[ -n "$(zle -lL autosuggest-fetch)" ]]; then
# only if suggestions not disabled (variable not set)
if ! [[ -v _ZSH_AUTOSUGGEST_DISABLED ]]; then
zle autosuggest-fetch
fi
fi
}
function _posh-zle-line-init() {