Fix issue #205, "';' after assignment is highlighted as unknown-token".

This commit is contained in:
Daniel Shahaf 2015-10-27 15:01:37 +02:00
parent 6d6fb8b03e
commit 01d7eeb3c7
2 changed files with 5 additions and 3 deletions

View file

@ -212,6 +212,9 @@ _zsh_highlight_main_highlighter()
fi
elif [[ $arg[0,1] == $histchars[0,1] || $arg[0,1] == $histchars[2,2] ]]; then
style=$ZSH_HIGHLIGHT_STYLES[history-expansion]
elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]] &&
[[ $this_word == *':regular:'* ]]; then
style=$ZSH_HIGHLIGHT_STYLES[commandseparator]
elif [[ $arg[1] == '<' || $arg[1] == '>' ]]; then
style=$ZSH_HIGHLIGHT_STYLES[redirection]
(( in_redirection=2 ))
@ -282,8 +285,7 @@ _zsh_highlight_main_highlighter()
next_word=':start:'
elif
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} && $this_word == *':start:' ]]; then
# TODO should this be '=' or '+=' ? $next_word is probably :regular: and nothing looks for that value.
next_word+=':start:'
next_word=':start:'
fi
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]] && highlight_glob=true
start_pos=$end_pos

View file

@ -31,6 +31,6 @@ ZSH_HIGHLIGHT_STYLES[commandseparator]=$unused_highlight
BUFFER='A=1; echo hello world'
expected_region_highlight=(
"4 4 $ZSH_HIGHLIGHT_STYLES[commandseparator] 'issue #205'" # ;
"4 4 $ZSH_HIGHLIGHT_STYLES[commandseparator]" # ;
"6 9 $ZSH_HIGHLIGHT_STYLES[command]" # echo
)