From 9e178f9f394823932887ecdcd1fa2834e54d21b1 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 30 Oct 2015 11:38:32 +0200 Subject: [PATCH] subshells: Highlight the opening parenthesis correctly. (Issue #166.) Followup to 0d1bfbcbfa675ca1de7a78513688990b813c1992. --- highlighters/main/main-highlighter.zsh | 3 ++- highlighters/main/test-data/subshell.zsh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index f5fd41e..7d4410d 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -279,8 +279,9 @@ _zsh_highlight_main_highlighter() style=$ZSH_HIGHLIGHT_STYLES[reserved-word] _zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style already_added=1 - elif [[ $arg == '()' ]]; then + elif [[ $arg == '()' || $arg == $'\x28' ]]; then # anonymous function + # subshell style=$ZSH_HIGHLIGHT_STYLES[reserved-word] else if _zsh_highlight_main_highlighter_check_path; then diff --git a/highlighters/main/test-data/subshell.zsh b/highlighters/main/test-data/subshell.zsh index aee6c49..18d2a23 100644 --- a/highlighters/main/test-data/subshell.zsh +++ b/highlighters/main/test-data/subshell.zsh @@ -31,7 +31,7 @@ BUFFER='tar cf - * | (cd /target; tar xfp -)' expected_region_highlight=( "1 3 $ZSH_HIGHLIGHT_STYLES[command]" # tar - "14 14 $ZSH_HIGHLIGHT_STYLES[reserved-word] 'issue #166'" # ( + "14 14 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # ( "15 16 $ZSH_HIGHLIGHT_STYLES[command]" # cd "27 29 $ZSH_HIGHLIGHT_STYLES[command]" # tar #"36 36 $ZSH_HIGHLIGHT_STYLES[?]" # )