From c0dafd1d850e582291b41d693369794d1ea31343 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 30 Oct 2015 20:20:30 +0200 Subject: [PATCH] brackets: Highlight the closing brackets of subshells and blocks. (Issue #226.) --- highlighters/main/main-highlighter.zsh | 2 ++ highlighters/main/test-data/subshell.zsh | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 69589ce..64a2032 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -299,6 +299,8 @@ _zsh_highlight_main_highlighter() fi else # $arg is a non-command word case $arg in + $'\x29') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; # subshell + $'\x7d') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; # block '--'*) style=$ZSH_HIGHLIGHT_STYLES[double-hyphen-option];; '-'*) style=$ZSH_HIGHLIGHT_STYLES[single-hyphen-option];; "'"*) style=$ZSH_HIGHLIGHT_STYLES[single-quoted-argument];; diff --git a/highlighters/main/test-data/subshell.zsh b/highlighters/main/test-data/subshell.zsh index 18d2a23..3e98476 100644 --- a/highlighters/main/test-data/subshell.zsh +++ b/highlighters/main/test-data/subshell.zsh @@ -27,12 +27,15 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- -BUFFER='tar cf - * | (cd /target; tar xfp -)' +BUFFER='tar cf - * | (cd /target; tar xfp -) | { cat }' expected_region_highlight=( "1 3 $ZSH_HIGHLIGHT_STYLES[command]" # tar "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[?]" # ) + "36 36 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # ) + "40 40 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # { + "42 44 $ZSH_HIGHLIGHT_STYLES[command]" # cat + "46 46 $ZSH_HIGHLIGHT_STYLES[reserved-word]" # } )