From 451665cb2a8ba80626aab295c88d23d0f341ea6c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 20 Jan 2016 22:10:45 +0000 Subject: [PATCH] 'main': Don't highlight at the $PS3 prompt. The input to the $PS3 prompt is not commands, so the 'main' highlighter is not applicable to it. Fixes zsh-users/zsh-syntax-highlighting#268. --- highlighters/main/main-highlighter.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index ca080c7..6312521 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -108,6 +108,15 @@ _zsh_highlight_main_highlighter() emulate -L zsh setopt localoptions extendedglob bareglobqual + # At the PS3 prompt, highlight nothing. + # + # (We can't check this in _zsh_highlight_main_highlighter_predicate because + # if the predicate returns false, the previous value of region_highlight + # would be reused.) + if [[ $CONTEXT == 'select' ]]; then + return + fi + ## Variable declarations and initializations local start_pos=0 end_pos highlight_glob=true arg style local in_array_assignment=false # true between 'a=(' and the matching ')'