From a59f442d2d3436a645100259d2396521461e1729 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 30 Oct 2015 17:28:48 +0000 Subject: [PATCH] brackets: Highlight the closing brackets of arithmetic expansion. (Issue #226.) --- highlighters/main/main-highlighter.zsh | 3 +++ highlighters/main/test-data/arithmetic-evaluation.zsh | 1 + 2 files changed, 4 insertions(+) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 5079f50..2867dcf 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -278,6 +278,9 @@ _zsh_highlight_main_highlighter() # is how [[ ... ]] is highlighted, too. style=$ZSH_HIGHLIGHT_STYLES[reserved-word] _zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style + if [[ $arg[-2,-1] == '))' ]]; then + _zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos $style + fi already_added=1 elif [[ $arg == '()' || $arg == $'\x28' ]]; then # anonymous function diff --git a/highlighters/main/test-data/arithmetic-evaluation.zsh b/highlighters/main/test-data/arithmetic-evaluation.zsh index dc26472..9287e91 100644 --- a/highlighters/main/test-data/arithmetic-evaluation.zsh +++ b/highlighters/main/test-data/arithmetic-evaluation.zsh @@ -36,4 +36,5 @@ BUFFER='(( x == 42 ))' expected_region_highlight=( "1 2 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # (( + "12 13 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # )) )