'main': Test for redirection earlier.
This is a prerequisite for the next commit. The incumbent code was wrong: the test of $in_redirection in the first hunk would never have seen «(( in_redirection == 2 ))». That had no visible effect since options to sudo don't look like redirection operators.
This commit is contained in:
parent
6e2ef574c8
commit
179b8e753f
@ -331,6 +331,11 @@ _zsh_highlight_main_highlighter()
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if _zsh_highlight_main__is_redirection $arg ; then
|
||||||
|
# A '<' or '>', possibly followed by a digit
|
||||||
|
in_redirection=2
|
||||||
|
fi
|
||||||
|
|
||||||
# Parse the sudo command line
|
# Parse the sudo command line
|
||||||
if (( ! in_redirection )); then
|
if (( ! in_redirection )); then
|
||||||
if [[ $this_word == *':sudo_opt:'* ]]; then
|
if [[ $this_word == *':sudo_opt:'* ]]; then
|
||||||
@ -432,10 +437,8 @@ _zsh_highlight_main_highlighter()
|
|||||||
else
|
else
|
||||||
style=unknown-token
|
style=unknown-token
|
||||||
fi
|
fi
|
||||||
elif _zsh_highlight_main__is_redirection $arg; then
|
elif (( in_redirection == 2 )); then
|
||||||
# A '<' or '>', possibly followed by a digit
|
|
||||||
style=redirection
|
style=redirection
|
||||||
(( in_redirection=2 ))
|
|
||||||
elif [[ $arg[1,2] == '((' ]]; then
|
elif [[ $arg[1,2] == '((' ]]; then
|
||||||
# Arithmetic evaluation.
|
# Arithmetic evaluation.
|
||||||
#
|
#
|
||||||
@ -509,9 +512,8 @@ _zsh_highlight_main_highlighter()
|
|||||||
else
|
else
|
||||||
style=unknown-token
|
style=unknown-token
|
||||||
fi
|
fi
|
||||||
elif _zsh_highlight_main__is_redirection $arg; then
|
elif (( in_redirection == 2 )); then
|
||||||
style=redirection
|
style=redirection
|
||||||
(( in_redirection=2 ))
|
|
||||||
else
|
else
|
||||||
if _zsh_highlight_main_highlighter_check_path; then
|
if _zsh_highlight_main_highlighter_check_path; then
|
||||||
style=$REPLY
|
style=$REPLY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user