mirror of
https://github.com/zsh-users/zsh-syntax-highlighting
synced 2024-12-14 23:44:45 +00:00
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
|
||||
_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
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user