main: Highlight backticks in double quotes
This commit is contained in:
parent
8d2955f51a
commit
f16e858f0c
@ -894,7 +894,7 @@ _zsh_highlight_main_highlighter_highlight_single_quote()
|
|||||||
# Highlight special chars inside double-quoted strings
|
# Highlight special chars inside double-quoted strings
|
||||||
_zsh_highlight_main_highlighter_highlight_double_quote()
|
_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 MATCH; integer MBEGIN MEND
|
||||||
local i j k style
|
local i j k style
|
||||||
reply=()
|
reply=()
|
||||||
@ -904,6 +904,12 @@ _zsh_highlight_main_highlighter_highlight_double_quote()
|
|||||||
(( k = j + 1 ))
|
(( k = j + 1 ))
|
||||||
case "$arg[$i]" in
|
case "$arg[$i]" in
|
||||||
'"') break;;
|
'"') break;;
|
||||||
|
'`') saved_reply=($reply)
|
||||||
|
_zsh_highlight_main_highlighter_highlight_backtick $i
|
||||||
|
(( i = REPLY ))
|
||||||
|
reply=($saved_reply $reply)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
'$' ) style=dollar-double-quoted-argument
|
'$' ) style=dollar-double-quoted-argument
|
||||||
# Look for an alphanumeric parameter name.
|
# Look for an alphanumeric parameter name.
|
||||||
if [[ ${arg:$i} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+) ]] ; then
|
if [[ ${arg:$i} =~ ^([A-Za-z_][A-Za-z0-9_]*|[0-9]+) ]] ; then
|
||||||
|
@ -28,9 +28,12 @@
|
|||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 42 is in the command position in a nested subshell.
|
# 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=(
|
expected_region_highlight=(
|
||||||
"6 18 back-quoted-argument"
|
"6 18 back-quoted-argument" # `echo \`42\``
|
||||||
"20 34 back-quoted-argument-unclosed"
|
"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
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user