File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ This highlighter defines the following styles:
53
53
* ` dollar-quoted-argument-unclosed ` - unclosed dollar-quoted arguments (`` $'foo `` )
54
54
* ` rc-quote ` - two single quotes inside single quotes when the ` RC_QUOTES ` option is set (`` 'foo''bar' `` )
55
55
* ` dollar-double-quoted-argument ` - parameter expansion inside double quotes (` $foo ` inside ` "" ` )
56
+ * ` back-un-quoted-argument ` - backslash escape sequences outside quotes (` \" ` in ` print -r \"bar\" ` )
56
57
* ` back-double-quoted-argument ` - backslash escape sequences inside double-quoted arguments (` \" ` in ` "foo\"bar" ` )
57
58
* ` back-dollar-quoted-argument ` - backslash escape sequences inside dollar-quoted arguments (` \x ` in ` $'\x48' ` )
58
59
* ` assign ` - parameter assignments (` x=foo ` and ` x=( ) ` )
Original file line number Diff line number Diff line change 53
53
: ${ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]:= fg=yellow}
54
54
: ${ZSH_HIGHLIGHT_STYLES[rc-quote]:= fg=cyan}
55
55
: ${ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]:= fg=cyan}
56
- : ${ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]:= fg=cyan}
56
+ : ${ZSH_HIGHLIGHT_STYLES[back-un-quoted-argument]:= fg=cyan}
57
+ : ${ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]:= fg=cyan,underline}
57
58
: ${ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]:= fg=cyan}
58
59
: ${ZSH_HIGHLIGHT_STYLES[assign]:= none}
59
60
: ${ZSH_HIGHLIGHT_STYLES[redirection]:= fg=yellow}
@@ -1202,7 +1203,13 @@ _zsh_highlight_main_highlighter_highlight_argument()
1202
1203
1203
1204
for (( ; i <= $# arg ; i += 1 )) ; do
1204
1205
case " $arg [$i ]" in
1205
- " \\ " ) (( i += 1 )) ; continue ;;
1206
+ " \\ " )
1207
+ highlights+=(
1208
+ $(( start_pos + i - 1 )) $(( start_pos + i + 1 )) back-double-quoted-argument
1209
+ )
1210
+ (( i += 1 ))
1211
+ continue
1212
+ ;;
1206
1213
" '" )
1207
1214
_zsh_highlight_main_highlighter_highlight_single_quote $i
1208
1215
(( i = REPLY ))
Original file line number Diff line number Diff line change @@ -34,4 +34,5 @@ expected_region_highlight=(
34
34
' 1 4 builtin' # echo
35
35
' 6 18 default "issue #705"' # foo\\\nbar"baz"
36
36
' 14 18 double-quoted-argument "issue #705"' # "baz"
37
+ # TODO: when fixing this, see if we can highlight the backslash-newline sequence as a comment.
37
38
)
You can’t perform that action at this time.
0 commit comments