'main': simple parameter expansions at command word: Don't use an undefined value.

Causes such expansions to be highlighted as [unknown-token] rather than as default (absent from $region_highlight).

Fixes #337.
This commit is contained in:
Daniel Shahaf 2016-06-10 14:25:00 +00:00
parent da91264122
commit d9e07b5082

View File

@ -374,7 +374,9 @@ _zsh_highlight_main_highlighter()
local -a match mbegin mend
local MATCH; integer MBEGIN MEND
if [[ $res == none ]] && (( ${+parameters} )) &&
[[ ${arg[1]} == \$ ]] && [[ ${arg:1} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]]; then
[[ ${arg[1]} == \$ ]] && [[ ${arg:1} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+)$ ]] &&
(( ${+parameters[${MATCH}]} ))
then
_zsh_highlight_main__type ${(P)MATCH}
res=$REPLY
fi