'main': Restore 0.6.0's behaviour for unknown options.
See discussion on #664.
This commit is contained in:
parent
5012d771f3
commit
cb166dcc77
@ -663,8 +663,15 @@ _zsh_highlight_main_highlighter_highlight_list()
|
||||
next_word+=':sudo_opt:'
|
||||
elif [[ $arg == '-'* ]]; then
|
||||
# Unknown flag. We don't know whether it takes an argument or not,
|
||||
# so we don't modify $next_word.
|
||||
# so modify $next_word as we do for flags that require no argument.
|
||||
# With that behaviour, if the flag in fact takes no argument we'll
|
||||
# highlight the inner command word correctly, and if it does take an
|
||||
# argument we'll highlight the command word correctly if the argument
|
||||
# was given in the same shell word as the flag (as in '-uphy1729' or
|
||||
# '--user=phy1729' without spaces).
|
||||
this_word=':sudo_opt:'
|
||||
next_word+=':start:'
|
||||
next_word+=':sudo_opt:'
|
||||
else
|
||||
# Not an option flag; nothing to do. (If the command line is
|
||||
# syntactically valid, ${this_word//:sudo_opt:/} should be
|
||||
|
@ -39,5 +39,5 @@ expected_region_highlight=(
|
||||
'12 12 commandseparator' # ;
|
||||
'14 17 precommand' # sudo
|
||||
'19 20 single-hyphen-option' # -x
|
||||
'22 23 default' # ls
|
||||
'22 23 command' # ls
|
||||
)
|
||||
|
@ -33,5 +33,5 @@ BUFFER='sudo --askpass ls'
|
||||
expected_region_highlight=(
|
||||
'1 4 precommand' # sudo
|
||||
'6 14 double-hyphen-option' # --askpass
|
||||
'16 17 default' # ls (we don't know whether --askpass takes an argument)
|
||||
'16 17 command' # ls (we don't know whether --askpass takes an argument)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user