diff --git a/highlighters/main/main-highlighter.zsh b/highlighters/main/main-highlighter.zsh index 6796a39..b8ed1a5 100644 --- a/highlighters/main/main-highlighter.zsh +++ b/highlighters/main/main-highlighter.zsh @@ -894,7 +894,7 @@ _zsh_highlight_main_highlighter_highlight_single_quote() # Highlight special chars inside double-quoted strings _zsh_highlight_main_highlighter_highlight_double_quote() { - local -a match mbegin mend + local -a match mbegin mend saved_reply local MATCH; integer MBEGIN MEND local i j k style reply=() @@ -904,6 +904,12 @@ _zsh_highlight_main_highlighter_highlight_double_quote() (( k = j + 1 )) case "$arg[$i]" in '"') break;; + '`') saved_reply=($reply) + _zsh_highlight_main_highlighter_highlight_backtick $i + (( i = REPLY )) + reply=($saved_reply $reply) + continue + ;; '$' ) style=dollar-double-quoted-argument # Look for an alphanumeric parameter name. if [[ ${arg:$i} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+) ]] ; then diff --git a/highlighters/main/test-data/back-quoted-argument.zsh b/highlighters/main/test-data/back-quoted-argument.zsh index 663ba6d..9355b28 100644 --- a/highlighters/main/test-data/back-quoted-argument.zsh +++ b/highlighters/main/test-data/back-quoted-argument.zsh @@ -28,9 +28,12 @@ # ------------------------------------------------------------------------------------------------- # 42 is in the command position in a nested subshell. -BUFFER='echo `echo \`42\`` `echo 6 times 9' +BUFFER='echo `echo \`42\`` "is `echo equal` to" `echo 6 times 9' expected_region_highlight=( - "6 18 back-quoted-argument" - "20 34 back-quoted-argument-unclosed" + "6 18 back-quoted-argument" # `echo \`42\`` + "20 23 double-quoted-argument" # "is + "24 35 back-quoted-argument" # `echo equal` + "36 39 double-quoted-argument" # to" + "41 55 back-quoted-argument-unclosed" # `echo 6 times 9 )