command word: Do not attempt to interpret command separator tokens as anything else.

The important part of this change is removing the second conjunct from the
condition; the remainder of the change gives one example of when that matters.
This commit is contained in:
Daniel Shahaf
2015-11-27 08:43:23 +00:00
parent cf685a3a27
commit 09c4114eb9
2 changed files with 46 additions and 5 deletions

View File

@@ -312,11 +312,14 @@ _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
# This highlights empty commands (semicolon follows nothing) as an error.
# Zsh accepts them, though.
style=$ZSH_HIGHLIGHT_STYLES[commandseparator]
elif [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then
if [[ $this_word == *':regular:'* ]]; then
# This highlights empty commands (semicolon follows nothing) as an error.
# Zsh accepts them, though.
style=$ZSH_HIGHLIGHT_STYLES[commandseparator]
else
style=$ZSH_HIGHLIGHT_STYLES[unknown-token]
fi
elif [[ $arg[1] == '<' || $arg[1] == '>' ]]; then
style=$ZSH_HIGHLIGHT_STYLES[redirection]
(( in_redirection=2 ))