Browse Source

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

pull/590/head
Daniel Shahaf 5 years ago
parent
commit
3e6d1375c9
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      highlighters/main/main-highlighter.zsh
  2. +3
    -1
      highlighters/main/test-data/alias.zsh

+ 1
- 1
highlighters/main/main-highlighter.zsh View File

@ -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

+ 3
- 1
highlighters/main/test-data/alias.zsh View File

@ -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
)

Loading…
Cancel
Save