command word: Highlight 'else' correctly. Part of issue #207.

This commit is contained in:
Daniel Shahaf 2015-10-28 17:32:23 +00:00
parent b397b12ac1
commit 2218e26bf8
2 changed files with 10 additions and 6 deletions

View File

@ -104,6 +104,7 @@ _zsh_highlight_main_highlighter()
'while' 'while'
'if' 'if'
'then' 'then'
'else'
'do' 'do'
) )

View File

@ -28,7 +28,7 @@
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight ZSH_HIGHLIGHT_STYLES[alias]=$unused_highlight
BUFFER='while if echo Hello; then ls /; fi; do stat "x"; done' BUFFER='while if echo Hello; then ls /; else ls; fi; do stat "x"; done'
expected_region_highlight+=( expected_region_highlight+=(
"1 5 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # while "1 5 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # while
@ -38,9 +38,12 @@ expected_region_highlight+=(
"22 25 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # then "22 25 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # then
"27 28 $ZSH_HIGHLIGHT_STYLES[command]" # ls "27 28 $ZSH_HIGHLIGHT_STYLES[command]" # ls
"30 30 $ZSH_HIGHLIGHT_STYLES[path]" # / "30 30 $ZSH_HIGHLIGHT_STYLES[path]" # /
"33 34 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # fi "31 31 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ;
"37 38 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # do "33 36 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # else
"40 43 $ZSH_HIGHLIGHT_STYLES[command]" # stat "38 39 $ZSH_HIGHLIGHT_STYLES[command]" # ls
"45 47 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "x" "42 43 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # fi
"50 53 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # done "46 47 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # do
"49 52 $ZSH_HIGHLIGHT_STYLES[command]" # stat
"54 56 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "x"
"59 62 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # done
) )