mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
940e10a691
This fixes a small issue in src/widgets.zsh which makes it so if you alias [ to g[ (as is done in prezto if the gnu-utility module is loaded) autosuggestions would fail. The documentation for GNU test mentions that -o and -a should be avoided if possible because it's not very clear. Also, with zsh and [[ -o actually tests if an option is set, which makes this option even more confusing.
26 lines
896 B
Bash
26 lines
896 B
Bash
|
|
#--------------------------------------------------------------------#
|
|
# Highlighting #
|
|
#--------------------------------------------------------------------#
|
|
|
|
# If there was a highlight, remove it
|
|
_zsh_autosuggest_highlight_reset() {
|
|
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
|
|
|
if [[ -n "$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT" ]]; then
|
|
region_highlight=("${(@)region_highlight:#$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT}")
|
|
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
|
fi
|
|
}
|
|
|
|
# If there's a suggestion, highlight it
|
|
_zsh_autosuggest_highlight_apply() {
|
|
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
|
|
|
if (( $#POSTDISPLAY )); then
|
|
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
|
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
|
|
else
|
|
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
|
fi
|
|
}
|