parent
dbdebfaaa5
commit
6e8984e2ec
|
@ -235,6 +235,16 @@ _zsh_highlight_highlighter_main_paint()
|
||||||
local -a options_to_set reply # used in callees
|
local -a options_to_set reply # used in callees
|
||||||
local REPLY
|
local REPLY
|
||||||
|
|
||||||
|
# $flags_with_argument is a set of letters, corresponding to the option letters
|
||||||
|
# that would be followed by a colon in a getopts specification.
|
||||||
|
local flags_with_argument
|
||||||
|
# $precommand_options maps precommand name to value of $flags_with_argument
|
||||||
|
# for that precommand.
|
||||||
|
local -A precommand_options
|
||||||
|
precommand_options=(
|
||||||
|
'sudo' Cgprtu
|
||||||
|
)
|
||||||
|
|
||||||
if [[ $zsyh_user_options[ignorebraces] == on || ${zsyh_user_options[ignoreclosebraces]:-off} == on ]]; then
|
if [[ $zsyh_user_options[ignorebraces] == on || ${zsyh_user_options[ignoreclosebraces]:-off} == on ]]; then
|
||||||
local right_brace_is_recognised_everywhere=false
|
local right_brace_is_recognised_everywhere=false
|
||||||
else
|
else
|
||||||
|
@ -537,7 +547,8 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||||
if [[ $this_word == *':sudo_opt:'* ]]; then
|
if [[ $this_word == *':sudo_opt:'* ]]; then
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
# Flag that requires an argument
|
# Flag that requires an argument
|
||||||
'-'[Cgprtu]) this_word=${this_word//:start:/};
|
'-'[$flags_with_argument])
|
||||||
|
this_word=${this_word//:start:/};
|
||||||
next_word=':sudo_arg:';;
|
next_word=':sudo_arg:';;
|
||||||
# This prevents misbehavior with sudo -u -otherargument
|
# This prevents misbehavior with sudo -u -otherargument
|
||||||
'-'*) this_word=${this_word//:start:/};
|
'-'*) this_word=${this_word//:start:/};
|
||||||
|
@ -559,8 +570,9 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||||
elif [[ $this_word == *':start:'* ]] && (( in_redirection == 0 )); then # $arg is the command word
|
elif [[ $this_word == *':start:'* ]] && (( in_redirection == 0 )); then # $arg is the command word
|
||||||
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]]; then
|
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} ]]; then
|
||||||
style=precommand
|
style=precommand
|
||||||
elif [[ "$arg" = "sudo" ]] && { _zsh_highlight_main__type sudo; [[ -n $REPLY && $REPLY != "none" ]] }; then
|
elif (( ${+precommand_options[$arg]} )) && { _zsh_highlight_main__type $arg; [[ -n $REPLY && $REPLY != "none" ]] }; then
|
||||||
style=precommand
|
style=precommand
|
||||||
|
flags_with_argument=${precommand_options[$arg]}
|
||||||
next_word=${next_word//:regular:/}
|
next_word=${next_word//:regular:/}
|
||||||
next_word+=':sudo_opt:'
|
next_word+=':sudo_opt:'
|
||||||
next_word+=':start:'
|
next_word+=':start:'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user