From 66eb801358b1a38cb268856b7ddfbddf8b71ba6c Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 24 Sep 2015 18:57:56 +0000 Subject: [PATCH] =?UTF-8?q?dollar-double-quoted-argument:=20Handle=20?= =?UTF-8?q?=C2=AB"foo$"=C2=BB=20correctly.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- highlighters/main/main-highlighter.zsh | 2 ++ highlighters/main/test-data/double-quoted3.zsh | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 4aca3a9..da27158 100755 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -272,6 +272,8 @@ _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 + else + continue fi ;; "\\") style=$ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument] diff --git a/highlighters/main/test-data/double-quoted3.zsh b/highlighters/main/test-data/double-quoted3.zsh index 919bf08..4a91c85 100644 --- a/highlighters/main/test-data/double-quoted3.zsh +++ b/highlighters/main/test-data/double-quoted3.zsh @@ -28,10 +28,11 @@ # vim: ft=zsh sw=2 ts=2 et # ------------------------------------------------------------------------------------------------- -BUFFER=': "$42foo"' +BUFFER=': "$" "$42foo"' expected_region_highlight=( - "3 3 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # " - "4 6 $ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]" # $42 - "7 10 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # foo" + "3 5 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "$" + "7 7 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # " + "8 10 $ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]" # $42 + "11 14 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # foo" )