File tree 6 files changed +8
-12
lines changed
6 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -641,7 +641,6 @@ _zsh_highlight_main_highlighter_highlight_list()
641
641
# Not an option flag; nothing to do. (If the command line is
642
642
# syntactically valid, ${this_word//:sudo_opt:/} should be
643
643
# non-empty now.)
644
- this_word= ${this_word//: sudo_opt:/ }
645
644
fi
646
645
elif [[ $this_word == * ' :sudo_arg:' * ]]; then
647
646
next_word+= ' :sudo_opt:'
@@ -651,15 +650,12 @@ _zsh_highlight_main_highlighter_highlight_list()
651
650
652
651
# The Great Fork: is this a command word? Is this a non-command word?
653
652
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:# " $arg " } ]]; then
654
- if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q; then
653
+ if _zsh_highlight_main__stack_pop T || _zsh_highlight_main__stack_pop Q ||
654
+ [[ $this_word == * :sudo_arg:* || $this_word == * :sudo_opt:* ]]; then
655
655
# Missing closing square bracket(s)
656
656
style=unknown-token
657
- elif [[ $this_word == * ' :regular:' * ]]; then
658
- # This highlights empty commands (semicolon follows nothing) as an error.
659
- # Zsh accepts them, though.
660
- style=commandseparator
661
657
else
662
- style=unknown-token
658
+ style=commandseparator
663
659
fi
664
660
if [[ $arg == ' ;' ]] && $in_array_assignment ; then
665
661
# literal newline inside an array assignment
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ BUFFER=$'{\nls\n} always { pwd }'
32
32
33
33
expected_region_highlight=(
34
34
' 1 1 reserved-word' # {
35
- ' 2 2 unknown-token ' # \n
35
+ ' 2 2 commandseparator ' # \n
36
36
' 3 4 command' # ls
37
37
' 5 5 commandseparator' # \n
38
38
' 6 6 reserved-word' # }
Original file line number Diff line number Diff line change @@ -33,6 +33,6 @@ BUFFER=$'# foo\ntrue'
33
33
34
34
expected_region_highlight=(
35
35
' 1 5 comment' # # foo
36
- ' 6 6 commandseparator "issue #501" ' # \n
36
+ ' 6 6 commandseparator' # \n
37
37
' 7 10 builtin' # true
38
38
)
Original file line number Diff line number Diff line change @@ -32,5 +32,5 @@ BUFFER='echo; ;'
32
32
expected_region_highlight=(
33
33
" 1 4 builtin" # echo
34
34
" 5 5 commandseparator" # ;
35
- " 7 7 unknown-token " # ;
35
+ " 7 7 commandseparator " # ;
36
36
)
Original file line number Diff line number Diff line change @@ -35,5 +35,5 @@ BUFFER='echo; ;'
35
35
expected_region_highlight=(
36
36
" 1 4 builtin" # echo
37
37
" 5 5 commandseparator" # ;
38
- " 7 7 unknown-token " # ;
38
+ " 7 7 commandseparator " # ;
39
39
)
Original file line number Diff line number Diff line change 31
31
BUFFER=$' \\\n ; ls'
32
32
33
33
expected_region_highlight=(
34
- ' 3 3 unknown-token ' # ;
34
+ ' 3 3 commandseparator ' # ;
35
35
' 5 6 command' # ls
36
36
)
You can’t perform that action at this time.
0 commit comments