From 6e3720f39d84f1dca76003dd22012ecadd21d6f7 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 17 Nov 2015 00:37:58 +0000 Subject: [PATCH] =?UTF-8?q?dollar-double-quoted-argument:=20Support=20the?= =?UTF-8?q?=20syntax=20=C2=AB"${foo}"=C2=BB.=20=20(Issue=20#186.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- highlighters/main/main-highlighter.zsh | 3 +++ highlighters/main/test-data/double-quoted4.zsh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 571ebb6..861ed0f 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -448,6 +448,9 @@ _zsh_highlight_main_highlighter_highlight_string() if [[ ${arg:$i} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+) ]] ; then (( k += $#MATCH )) # highlight the parameter name (( i += $#MATCH )) # skip past it + elif [[ ${arg:$i} =~ ^[{]([A-Za-z_][A-Za-z0-9_]*|[0-9]+)[}] ]] ; then + (( k += $#MATCH )) # highlight the parameter name and braces + (( i += $#MATCH )) # skip past it else continue fi diff --git a/highlighters/main/test-data/double-quoted4.zsh b/highlighters/main/test-data/double-quoted4.zsh index 3568321..bec056e 100644 --- a/highlighters/main/test-data/double-quoted4.zsh +++ b/highlighters/main/test-data/double-quoted4.zsh @@ -31,6 +31,6 @@ BUFFER=': "${foo}bar"' expected_region_highlight=( "3 3 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # " - "4 9 $ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument] 'issue #186'" # ${foo} + "4 9 $ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]" # ${foo} "10 13 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # bar" )