From ea3ae74164bdc1f38b23f6b4c339ac637bfb923b Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 13 May 2020 12:51:52 +0000 Subject: [PATCH] 'main': Fix the last commit's bug concerning parameter elision not happening in redirects in command position. --- highlighters/main/main-highlighter.zsh | 2 +- .../main/test-data/redirection-inhibits-elision.zsh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 59d4036..6053337 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -750,7 +750,7 @@ _zsh_highlight_main_highlighter_highlight_list() # parameters that refer to commands, functions, and builtins. () { local -a words; words=( "${reply[@]}" ) - if (( $#words == 0 )); then + if (( $#words == 0 )) && (( ! in_redirection )); then # Parameter elision is happening (( ++in_redirection )) _zsh_highlight_main_add_region_highlight $start_pos $end_pos comment diff --git a/highlighters/main/test-data/redirection-inhibits-elision.zsh b/highlighters/main/test-data/redirection-inhibits-elision.zsh index be5e431..c0ca267 100644 --- a/highlighters/main/test-data/redirection-inhibits-elision.zsh +++ b/highlighters/main/test-data/redirection-inhibits-elision.zsh @@ -32,7 +32,7 @@ BUFFER=$'<$foo cat cat' expected_region_highlight=( '1 1 redirection' # < - '2 5 default "fixed in the next commit"' # $foo - '7 9 command "fixed in the next commit"' # cat - '11 13 default "fixed in the next commit"' # cat + '2 5 default' # $foo + '7 9 command' # cat + '11 13 default' # cat )