瀏覽代碼

sudo/redirections: Fix remaining part of issue #221, "sudo and redirection don't mix".

pull/232/head
Daniel Shahaf 9 年之前
父節點
當前提交
86e9249709
共有 2 個檔案被更改,包括 3 行新增2 行删除
  1. +2
    -1
      highlighters/main/main-highlighter.zsh
  2. +1
    -1
      highlighters/main/test-data/sudo-redirection2.zsh

+ 2
- 1
highlighters/main/main-highlighter.zsh 查看文件

@ -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:';;

+ 1
- 1
highlighters/main/test-data/sudo-redirection2.zsh 查看文件

@ -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
)

Loading…
取消
儲存