Skip to content

Commit 96e6cbe

Browse files
committed
'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.
1 parent 2a30d4f commit 96e6cbe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

highlighters/main/main-highlighter.zsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ _zsh_highlight_main_highlighter__try_expand_parameter()
448448
else
449449
parameter_name=${arg:1}
450450
fi
451-
if [[ $res == none ]] && zmodload -e zsh/parameter &&
451+
if [[ $res == none ]] &&
452452
[[ ${parameter_name} =~ ^${~parameter_name_pattern}$ ]] &&
453-
[[ ${parameters[(e)$MATCH]} != *special* ]]
453+
[[ ${(tP)MATCH} != *special* ]]
454454
then
455455
# Set $arg and update $res.
456456
case ${(tP)MATCH} in

0 commit comments

Comments
 (0)