main: Fix check for suffix aliases (fixes #574)

This commit is contained in:
Daniel Shahaf 2018-10-30 21:25:59 +00:00
parent 4ce56a821e
commit 3e6d1375c9
2 changed files with 4 additions and 2 deletions

View File

@ -163,7 +163,7 @@ _zsh_highlight_main__type() {
fi fi
if (( $+aliases[(e)$1] )) && (( aliases_allowed )); then if (( $+aliases[(e)$1] )) && (( aliases_allowed )); then
REPLY=alias REPLY=alias
elif (( $+saliases[(e)${1##*.}] )); then elif [[ $1 == *.* && -n ${1%.*} ]] && (( $+saliases[(e)${1##*.}] )); then
REPLY='suffix alias' REPLY='suffix alias'
elif (( $reswords[(Ie)$1] )); then elif (( $reswords[(Ie)$1] )); then
REPLY=reserved REPLY=reserved

View File

@ -31,7 +31,7 @@ alias alias1="ls"
alias -s alias2="echo" alias -s alias2="echo"
function alias1() {} # to check that it's highlighted as an alias, not as a function function alias1() {} # to check that it's highlighted as an alias, not as a function
BUFFER='x.alias2; alias1' BUFFER='x.alias2; alias1; alias2'
# Set expected_region_highlight as a function of zsh version. # Set expected_region_highlight as a function of zsh version.
# #
@ -49,4 +49,6 @@ expected_region_highlight+=(
"9 9 commandseparator" # ; "9 9 commandseparator" # ;
"11 16 alias" # alias1 "11 16 alias" # alias1
"11 16 command" # alias1 (ls) "11 16 command" # alias1 (ls)
"17 17 commandseparator" # ;
"19 24 unknown-token" # alias2
) )