From 3e6d1375c93a3e3eb82c7892e57243f0b69ba286 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 30 Oct 2018 21:25:59 +0000 Subject: [PATCH] main: Fix check for suffix aliases (fixes #574) --- highlighters/main/main-highlighter.zsh | 2 +- highlighters/main/test-data/alias.zsh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 12e48fe..06839ce 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -163,7 +163,7 @@ _zsh_highlight_main__type() { fi if (( $+aliases[(e)$1] )) && (( aliases_allowed )); then REPLY=alias - elif (( $+saliases[(e)${1##*.}] )); then + elif [[ $1 == *.* && -n ${1%.*} ]] && (( $+saliases[(e)${1##*.}] )); then REPLY='suffix alias' elif (( $reswords[(Ie)$1] )); then REPLY=reserved diff --git a/highlighters/main/test-data/alias.zsh b/highlighters/main/test-data/alias.zsh index 8330a04..03ca0be 100644 --- a/highlighters/main/test-data/alias.zsh +++ b/highlighters/main/test-data/alias.zsh @@ -31,7 +31,7 @@ alias alias1="ls" alias -s alias2="echo" 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. # @@ -49,4 +49,6 @@ expected_region_highlight+=( "9 9 commandseparator" # ; "11 16 alias" # alias1 "11 16 command" # alias1 (ls) + "17 17 commandseparator" # ; + "19 24 unknown-token" # alias2 )