Skip to content

Commit a59f442

Browse files
committed
brackets: Highlight the closing brackets of arithmetic expansion. (Issue #226.)
1 parent 8b4adbd commit a59f442

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

highlighters/main/main-highlighter.zsh

+3
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ _zsh_highlight_main_highlighter()
278278
# is how [[ ... ]] is highlighted, too.
279279
style=$ZSH_HIGHLIGHT_STYLES[reserved-word]
280280
_zsh_highlight_main_add_region_highlight $start_pos $((start_pos + 2)) $style
281+
if [[ $arg[-2,-1] == '))' ]]; then
282+
_zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos $style
283+
fi
281284
already_added=1
282285
elif [[ $arg == '()' || $arg == $'\x28' ]]; then
283286
# anonymous function

highlighters/main/test-data/arithmetic-evaluation.zsh

+1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ BUFFER='(( x == 42 ))'
3636

3737
expected_region_highlight=(
3838
"1 2 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # ((
39+
"12 13 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # ))
3940
)

0 commit comments

Comments
 (0)