'main': Highlight array parameters in command position.
This commit is contained in:
parent
ad6261fbca
commit
31ceaed4f4
|
@ -553,7 +553,17 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||||
[[ ${parameter_name} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
|
[[ ${parameter_name} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
|
||||||
(( ${+parameters[(e)${MATCH}]} )) && [[ ${parameters[(e)$MATCH]} != *special* ]]
|
(( ${+parameters[(e)${MATCH}]} )) && [[ ${parameters[(e)$MATCH]} != *special* ]]
|
||||||
then
|
then
|
||||||
arg=${(P)MATCH}
|
# Set $arg.
|
||||||
|
case ${(tP)MATCH} in
|
||||||
|
(*array*|*assoc*)
|
||||||
|
local -a words; words=( ${(P)MATCH} )
|
||||||
|
arg=${words[1]}
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
# scalar, presumably
|
||||||
|
arg=${(P)MATCH}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
_zsh_highlight_main__type "$arg"
|
_zsh_highlight_main__type "$arg"
|
||||||
res=$REPLY
|
res=$REPLY
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -29,9 +29,10 @@
|
||||||
|
|
||||||
local x=/usr/bin/env
|
local x=/usr/bin/env
|
||||||
local y=sudo
|
local y=sudo
|
||||||
|
local -a z; z=(zsh -f)
|
||||||
sudo(){}
|
sudo(){}
|
||||||
|
|
||||||
BUFFER='$x "argument"; $y'
|
BUFFER='$x "argument"; $y; $z'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
"1 2 command" # $x
|
"1 2 command" # $x
|
||||||
|
@ -39,4 +40,6 @@ expected_region_highlight=(
|
||||||
"4 13 double-quoted-argument" # "argument"
|
"4 13 double-quoted-argument" # "argument"
|
||||||
"14 14 commandseparator" # ;
|
"14 14 commandseparator" # ;
|
||||||
"16 17 precommand" # $y (sudo)
|
"16 17 precommand" # $y (sudo)
|
||||||
|
"18 18 unknown-token" # ;
|
||||||
|
"20 21 command" # $z - 'zsh' being the command
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user