From c0e64fe13178a6614a18ed7c0da52b8d2266a02b Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Wed, 14 Mar 2018 22:47:33 -0500 Subject: [PATCH] main: Highlight =( ) process substitutions --- highlighters/main/main-highlighter.zsh | 11 +++++++++-- ...process-substitution-redirection-isnt-globbing.zsh | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 7b71ec7..2373ccd 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -842,7 +842,7 @@ _zsh_highlight_main_highlighter_check_path() # This command will at least highlight start_pos to end_pos with the default style _zsh_highlight_main_highlighter_highlight_argument() { - local base_style=default i path_eligible=1 start style + local base_style=default i=1 path_eligible=1 start style local -a highlights local -a match mbegin mend @@ -857,9 +857,16 @@ _zsh_highlight_main_highlighter_highlight_argument() fi path_eligible=0 ;; + '=') + if [[ $arg[2] == $'\x28' ]]; then + (( i += 2 )) + _zsh_highlight_main_highlighter_highlight_list $(( start_pos + i - 1 )) S $has_end $arg[i,end_pos] + (( i += REPLY )) + highlights+=($start_pos $(( start_pos + i )) process-substitution $reply) + fi esac - for (( i = 1 ; i <= end_pos - start_pos ; i += 1 )); do + for (( ; i <= end_pos - start_pos ; i += 1 )); do case "$arg[$i]" in "\\") (( i += 1 )); continue;; "'") diff --git a/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh b/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh index 05c11b8..d5de3fd 100644 --- a/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh +++ b/highlighters/main/test-data/process-substitution-redirection-isnt-globbing.zsh @@ -33,4 +33,7 @@ BUFFER=$': =(