-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See [zsh-workers 48936](https://www.zsh.org/mla/workers/2021/msg01162.html). Fixes issue #274.
- Loading branch information
1 parent
a99fcd4
commit 70f6aa0
Showing
3 changed files
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
#autoload | ||
unset MENUSELECT | ||
unset curcontext | ||
compstate[insert]= | ||
compstate[list]= | ||
|
||
local key_name=${(kL)key[(Re)$KEYS]} | ||
local key_style; zstyle -s :autocomplete:${key_name}: widget-style key_style | ||
|
||
if ( [[ $KEYS == $key[Shift-Tab] ]] || | ||
zstyle -t ":autocomplete:${(kL)key[(Re)$KEYS]}:" insert-unambiguous | ||
zstyle -t ":autocomplete:${key_name}:" insert-unambiguous | ||
) && [[ $IPREFIX$PREFIX$SUFFIX$ISUFFIX != *${compstate[unambiguous]:#?}* ]]; then | ||
compstate[insert]=${${(M)WIDGET:#*menu-*}:+automenu-}unambiguous | ||
# Work around a crashing bug in Zsh. | ||
# See [zsh-workers 48936](https://www.zsh.org/mla/workers/2021/msg01162.html). | ||
[[ $key_style == *menu-* && $KEYS == ($key[Tab]|$key[Shift-Tab]) ]] && | ||
compstate[insert]='automenu-' | ||
|
||
compstate[insert]+=unambiguous | ||
return | ||
fi | ||
|
||
compstate[insert]= | ||
unset MENUSELECT | ||
|
||
if [[ $WIDGET == *menu-select ]]; then | ||
# Determine which terminal line we're on (for async completion). | ||
(( _autocomplete__buffer_start_line = max( BUFFERLINES, LINES - compstate[list_lines] ) )) | ||
MENUSELECT=0 | ||
fi | ||
|
||
# Work around a crashing bug in Zsh. | ||
# See [zsh-workers 48936](https://www.zsh.org/mla/workers/2021/msg01162.html). | ||
[[ $key_style == *menu-* && $KEYS == ($key[Tab]|$key[Shift-Tab]) ]] && | ||
compstate[insert]='menu:' | ||
|
||
if [[ $KEYS == $key[Shift-Tab] ]]; then | ||
compstate[insert]+=0 | ||
compstate[insert]+='0' | ||
else | ||
compstate[insert]+=1 | ||
compstate[insert]+='1' | ||
fi | ||
|
||
local -a tags; zstyle -a :autocomplete: add-space tags || | ||
tags=( executables aliases functions builtins reserved-words commands ) | ||
if [[ $RBUFFER != [[:space:]]* && -n ${${=${_comp_tags:-$_lastcomp[tags]}}:*tags} ]]; then | ||
[[ $WIDGET == *menu-* ]] && | ||
compstate[insert]="menu:$compstate[insert]" | ||
compstate[insert]+=' ' | ||
fi | ||
tags=( executables aliases functions builtins reserved-words commands ) | ||
[[ $RBUFFER != [[:space:]]* && -n ${${=${_comp_tags:-$_lastcomp[tags]}}:*tags} ]] && | ||
compstate[insert]+=' ' |