'main': Fix expansion of positional parameters in _zsh_highlight_main_highlighter__try_expand_parameter.

As described in the last commit's log message, ${parameter_name_pattern]
explicitly matches positional parameters but ${parameters[$MATCH]}
expands to nothing in that case (when, e.g., [[ $MATCH == '1' ]]; note
this is equality of strings, not integers).

As a side effect, this removes the dependency on the zsh/parameter
module for expanding parameters.
This commit is contained in:
Daniel Shahaf 2020-04-02 23:40:52 +00:00
parent 2a30d4fb5a
commit 96e6cbe22f

View File

@ -448,9 +448,9 @@ _zsh_highlight_main_highlighter__try_expand_parameter()
else
parameter_name=${arg:1}
fi
if [[ $res == none ]] && zmodload -e zsh/parameter &&
if [[ $res == none ]] &&
[[ ${parameter_name} =~ ^${~parameter_name_pattern}$ ]] &&
[[ ${parameters[(e)$MATCH]} != *special* ]]
[[ ${(tP)MATCH} != *special* ]]
then
# Set $arg and update $res.
case ${(tP)MATCH} in