back-dollar-quoted-argument: Highlight \uHHHH and \UHHHHHHHH escapes.
This commit is contained in:
parent
98366ade11
commit
8a43bd2cd9
@ -312,11 +312,15 @@ _zsh_highlight_main_highlighter_highlight_dollar_string()
|
|||||||
case "$arg[$i]" in
|
case "$arg[$i]" in
|
||||||
"\\") style=$ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]
|
"\\") style=$ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]
|
||||||
for (( c = i + 1 ; c < end_pos - start_pos ; c += 1 )); do
|
for (( c = i + 1 ; c < end_pos - start_pos ; c += 1 )); do
|
||||||
[[ "$arg[$c]" != ([0-9xXa-fA-F]) ]] && break
|
[[ "$arg[$c]" != ([0-9xXuUa-fA-F]) ]] && break
|
||||||
done
|
done
|
||||||
AA=$arg[$i+1,$c-1]
|
AA=$arg[$i+1,$c-1]
|
||||||
# Matching for HEX and OCT values like \0xA6, \xA6 or \012
|
# Matching for HEX and OCT values like \0xA6, \xA6 or \012
|
||||||
if [[ "$AA" =~ "^((x|X)[0-9a-fA-F]{1,2})" || "$AA" =~ "^(0[0-7]{1,3})" ]];then
|
if [[ "$AA" =~ "^(x|X)[0-9a-fA-F]{1,2}"
|
||||||
|
|| "$AA" =~ "^0[0-7]{1,3}"
|
||||||
|
|| "$AA" =~ "^u[0-9a-fA-F]{1,4}"
|
||||||
|
|| "$AA" =~ "^U[0-9a-fA-F]{1,8}"
|
||||||
|
]]; then
|
||||||
(( k += $#MATCH ))
|
(( k += $#MATCH ))
|
||||||
(( i += $#MATCH ))
|
(( i += $#MATCH ))
|
||||||
else
|
else
|
||||||
|
@ -29,10 +29,12 @@
|
|||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight
|
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=$unused_highlight
|
||||||
BUFFER=": \$'foo\xbar'"
|
BUFFER=": \$'foo\xbar\udeadbeef'"
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
"3 7 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # $'foo
|
"3 7 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # $'foo
|
||||||
"8 11 $ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]" # \xba
|
"8 11 $ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]" # \xba
|
||||||
"12 13 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # r'
|
"12 12 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # r
|
||||||
|
"13 18 $ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]" # \dead
|
||||||
|
"19 23 $ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]" # beef'
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user