Skip to content

Commit 3e6d137

Browse files
committed
main: Fix check for suffix aliases (fixes #574)
1 parent 4ce56a8 commit 3e6d137

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

highlighters/main/main-highlighter.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ _zsh_highlight_main__type() {
163163
fi
164164
if (( $+aliases[(e)$1] )) && (( aliases_allowed )); then
165165
REPLY=alias
166-
elif (( $+saliases[(e)${1##*.}] )); then
166+
elif [[ $1 == *.* && -n ${1%.*} ]] && (( $+saliases[(e)${1##*.}] )); then
167167
REPLY='suffix alias'
168168
elif (( $reswords[(Ie)$1] )); then
169169
REPLY=reserved

highlighters/main/test-data/alias.zsh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ alias alias1="ls"
3131
alias -s alias2="echo"
3232
function alias1() {} # to check that it's highlighted as an alias, not as a function
3333

34-
BUFFER='x.alias2; alias1'
34+
BUFFER='x.alias2; alias1; alias2'
3535

3636
# Set expected_region_highlight as a function of zsh version.
3737
#
@@ -49,4 +49,6 @@ expected_region_highlight+=(
4949
"9 9 commandseparator" # ;
5050
"11 16 alias" # alias1
5151
"11 16 command" # alias1 (ls)
52+
"17 17 commandseparator" # ;
53+
"19 24 unknown-token" # alias2
5254
)

0 commit comments

Comments
 (0)