Do not escape $ unless DQ is set, that is the only case where we need to

escape it.
This commit is contained in:
nicm 2024-05-24 12:41:24 +00:00
parent 9e7c1aee48
commit 692ce59bce

2
utf8.c
View File

@ -517,7 +517,7 @@ utf8_strvis(char *dst, const char *src, size_t len, int flag)
/* Not a complete, valid UTF-8 character. */ /* Not a complete, valid UTF-8 character. */
src -= ud.have; src -= ud.have;
} }
if (src[0] == '$' && src < end - 1) { if ((flag & VIS_DQ) && src[0] == '$' && src < end - 1) {
if (isalpha((u_char)src[1]) || if (isalpha((u_char)src[1]) ||
src[1] == '_' || src[1] == '_' ||
src[1] == '{') src[1] == '{')