Fix issue #209, "precommand modifiers at non-command-word position".

This commit is contained in:
Daniel Shahaf 2015-10-27 13:35:04 +02:00
parent 88cf98d9c4
commit 2c9f8c8c95
2 changed files with 5 additions and 2 deletions

View file

@ -261,7 +261,10 @@ _zsh_highlight_main_highlighter()
# if a style_override was set (eg in _zsh_highlight_main_highlighter_check_path), use it
[[ -n $style_override ]] && style=$ZSH_HIGHLIGHT_STYLES[$style_override]
(( already_added )) || _zsh_highlight_main_add_region_highlight $start_pos $end_pos $style
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && next_word+=':start:'
if [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]] ||
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_PRECOMMANDS:#"$arg"} && $this_word == *':start:' ]]; then
next_word+=':start:'
fi
[[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]] && highlight_glob=true
start_pos=$end_pos
this_word=$next_word

View file

@ -33,5 +33,5 @@ BUFFER=': command zzzzzz'
expected_region_highlight=(
"1 1 $ZSH_HIGHLIGHT_STYLES[command]" # ls
"3 9 $ZSH_HIGHLIGHT_STYLES[default]" # not precommand
"11 16 $ZSH_HIGHLIGHT_STYLES[default] 'issue #209'" # not unknown-token (since 'zzzzzz' is not a command)
"11 16 $ZSH_HIGHLIGHT_STYLES[default]" # not unknown-token (since 'zzzzzz' is not a command)
)