mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-02-13 10:05:31 +08:00
'main': Highlight array parameters in command position.
This commit is contained in:
parent
caa727f9ac
commit
1bf54d7f26
@ -513,7 +513,17 @@ _zsh_highlight_highlighter_main_paint()
|
||||
[[ ${parameter_name} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
|
||||
(( ${+parameters[${MATCH}]} ))
|
||||
then
|
||||
arg=${(P)MATCH}
|
||||
# Set $arg.
|
||||
case ${(tP)MATCH} in
|
||||
(*array*|*assoc*)
|
||||
local -a words=( ${(P)MATCH} )
|
||||
arg=${words[1]}
|
||||
;;
|
||||
(*)
|
||||
# scalar, presumably
|
||||
arg=${(P)MATCH}
|
||||
;;
|
||||
esac
|
||||
_zsh_highlight_main__type "$arg"
|
||||
res=$REPLY
|
||||
fi
|
||||
|
@ -29,10 +29,12 @@
|
||||
|
||||
local x=/usr/bin/env
|
||||
local y=sudo
|
||||
BUFFER='$x "argument"; $y'
|
||||
local -a z; z=(zsh -f)
|
||||
BUFFER='$x "argument"; $y; $z'
|
||||
|
||||
expected_region_highlight=(
|
||||
"1 2 command" # $x
|
||||
"4 13 double-quoted-argument" # "argument"
|
||||
"16 17 precommand" # $y (sudo)
|
||||
"20 21 command" # $z - 'zsh' being the command
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user