Skip to content

Commit

Permalink
Fix autosuggestions compatibility
Browse files Browse the repository at this point in the history
Fixes #576.
  • Loading branch information
marlonrichert committed May 18, 2023
1 parent acb06e0 commit 353f004
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/.autocomplete.async
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,25 @@ builtin zle -N history-incremental-search-backward .autocomplete.async.history-i

typeset -g _autocomplete__region_highlight=( "$region_highlight[@]" )

.autocomplete.async.stop

if [[ -v ZSH_AUTOSUGGEST_IGNORE_WIDGETS ]] && (( ZSH_AUTOSUGGEST_IGNORE_WIDGETS[(I)$LASTWIDGET] )); then
unset POSTDISPLAY
_zsh_autosuggest_fetch
fi

# This means we're in the completion menu.
[[ $LASTWIDGET == .autocomplete.async.complete.fd-widget ]] &&
# Don't get triggered by asynchronous widgets.
if [[ $LASTWIDGET == (autosuggest-suggest|.autocomplete.async.complete.fd-widget) ]]; then
return

.autocomplete.async.stop
fi

if (( REGION_ACTIVE )) ||
[[ -v _autocomplete__isearch && $LASTWIDGET == *(incremental|isearch)* ]]; then
builtin zle -Rc
return 0
fi

[[ $LASTWIDGET == (_complete_help|(|.)(describe-key-briefly|what-cursor-position|where-is)) ]] &&
[[ $LASTWIDGET ==
(_complete_help|(|.)(describe-key-briefly|(|.)(|reverse-)menu-complete|what-cursor-position|where-is)) ]] &&
return

[[ $KEYS == ([\ -+*]|$'\e\t') ]] &&
Expand Down

0 comments on commit 353f004

Please sign in to comment.