Skip to content

Commit

Permalink
sudo/redirections: Fix remaining part of issue sorin-ionescu#221, "su…
Browse files Browse the repository at this point in the history
…do and redirection don't mix".
  • Loading branch information
danielshahaf committed Oct 29, 2015
1 parent 0d1bfbc commit 86e9249
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion highlighters/main/main-highlighter.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ _zsh_highlight_main_highlighter()
if [[ $this_word == *':sudo_opt:'* ]]; then
case "$arg" in
# Flag that requires an argument
'-'[Cgprtu]) next_word=':sudo_arg:';;
'-'[Cgprtu]) this_word=${this_word//:start:/};
next_word=':sudo_arg:';;
# This prevents misbehavior with sudo -u -otherargument
'-'*) next_word+=':sudo_opt:';;
*) this_word+=':start:';;
Expand Down
2 changes: 1 addition & 1 deletion highlighters/main/test-data/sudo-redirection2.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ expected_region_highlight=(
"1 4 $ZSH_HIGHLIGHT_STYLES[precommand]" # sudo
"6 6 $ZSH_HIGHLIGHT_STYLES[redirection]" # >
"7 10 $ZSH_HIGHLIGHT_STYLES[path]" # /tmp
"12 13 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option] 'issue #221'" # -u
"12 13 $ZSH_HIGHLIGHT_STYLES[single-hyphen-option]" # -u
"15 23 $ZSH_HIGHLIGHT_STYLES[default]" # otheruser
"25 26 $ZSH_HIGHLIGHT_STYLES[command]" # ls
)

0 comments on commit 86e9249

Please sign in to comment.