@@ -651,8 +651,8 @@ _zsh_highlight_main_highlighter_highlight_list()
651
651
652
652
# The Great Fork: is this a command word? Is this a non-command word?
653
653
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:# " $arg " } ]]; then
654
- if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then
655
- # Missing closing square bracket(s)
654
+ if (( in_redirection )) || _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then
655
+ # Unfinished redirection or missing closing square bracket(s)
656
656
style=unknown-token
657
657
elif [[ $this_word == * ' :regular:' * ]]; then
658
658
# This highlights empty commands (semicolon follows nothing) as an error.
@@ -668,11 +668,21 @@ _zsh_highlight_main_highlighter_highlight_list()
668
668
next_word=' :start:'
669
669
highlight_glob=true
670
670
fi
671
- elif ! (( in_redirection)) && [[ $this_word == * ' :always:' * && $arg == ' always' ]]; then
671
+ elif (( in_redirection )) ; then
672
+ if [[ $this_word == * :function:* ]]; then
673
+ this_word=' :start:'
674
+ fi
675
+ if [[ $arg == ($' \x29 ' | ' ()' ) ]] || { [[ $arg == $' \x7d ' ]] && $right_brace_is_recognised_everywhere }; then
676
+ style=unknown-token
677
+ else
678
+ _zsh_highlight_main_highlighter_highlight_argument 1 0
679
+ continue
680
+ fi
681
+ elif [[ $this_word == * ' :always:' * && $arg == ' always' ]]; then
672
682
# try-always construct
673
683
style=reserved-word # de facto a reserved word, although not de jure
674
684
next_word=' :start:'
675
- elif ! (( in_redirection )) && [[ $this_word == * ' :start:' * ]]; then # $arg is the command word
685
+ elif [[ $this_word == * ' :start:' * ]]; then # $arg is the command word
676
686
if (( ${+precommand_options[$arg]} )) && _zsh_highlight_main__is_runnable $arg ; then
677
687
style=precommand
678
688
flags_with_argument=${precommand_options[$arg]%:* }
@@ -831,8 +841,6 @@ _zsh_highlight_main_highlighter_highlight_list()
831
841
style=assign
832
842
in_array_assignment=false
833
843
next_word+=' :start:'
834
- elif (( in_redirection )) ; then
835
- style=unknown-token
836
844
else
837
845
if _zsh_highlight_main__stack_pop ' S' ; then
838
846
REPLY=$start_pos
@@ -858,7 +866,7 @@ _zsh_highlight_main_highlighter_highlight_list()
858
866
#
859
867
# Additionally, `tt(})' is recognized in any position if neither the
860
868
# tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set.
861
- if (( in_redirection )) || $in_array_assignment ; then
869
+ if $in_array_assignment ; then
862
870
style=unknown-token
863
871
else
864
872
_zsh_highlight_main__stack_pop ' Y' reserved-word
@@ -873,7 +881,7 @@ _zsh_highlight_main_highlighter_highlight_list()
873
881
elif [[ $arg == $' \x5d ' ]] && _zsh_highlight_main__stack_pop ' Q' builtin ; then
874
882
:
875
883
else
876
- _zsh_highlight_main_highlighter_highlight_argument 1 $(( 1 != in_redirection ))
884
+ _zsh_highlight_main_highlighter_highlight_argument 1 1
877
885
continue
878
886
fi
879
887
;;
0 commit comments