From 27bfb56ad5e19afa686ed6a99bf8b205fac98aef Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 23 May 2019 14:03:44 +0000 Subject: Break the argument escaping code into a separate function and use it to escape key bindings in list-keys. Also escape ~ and ; and $ properly. --- utf8.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'utf8.c') diff --git a/utf8.c b/utf8.c index 08990634..29bbfa9e 100644 --- a/utf8.c +++ b/utf8.c @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -182,7 +183,11 @@ utf8_strvis(char *dst, const char *src, size_t len, int flag) /* Not a complete, valid UTF-8 character. */ src -= ud.have; } - if (src < end - 1) + if (src[0] == '$' && src < end - 1) { + if (isalpha((u_char)src[1]) || src[1] == '_') + *dst++ = '\\'; + *dst++ = '$'; + } else if (src < end - 1) dst = vis(dst, src[0], flag, src[1]); else if (src < end) dst = vis(dst, src[0], flag, '\0'); -- cgit