Mercurial > vim
diff src/message.c @ 28686:141fb1d233ba v8.2.4867
patch 8.2.4867: listing of mapping with K_SPECIAL is wrong
Commit: https://github.com/vim/vim/commit/ac402f4d64bec6b6efd809fef52f5b34627bf947
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed May 4 18:51:43 2022 +0100
patch 8.2.4867: listing of mapping with K_SPECIAL is wrong
Problem: Listing of mapping with K_SPECIAL is wrong.
Solution: Adjust escaping of special characters. (closes https://github.com/vim/vim/issues/10351)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 May 2022 20:00:03 +0200 |
parents | bef82285dda0 |
children | d770568e6c98 |
line wrap: on
line diff
--- a/src/message.c +++ b/src/message.c @@ -1800,19 +1800,29 @@ str2special( if (has_mbyte && !IS_SPECIAL(c)) { - int len = (*mb_ptr2len)(str); - - // For multi-byte characters check for an illegal byte. - if (MB_BYTE2LEN(*str) > len) + char_u *p; + + *sp = str; + // Try to un-escape a multi-byte character after modifiers. + p = mb_unescape(sp); + + if (p == NULL) { - transchar_nonprint(curbuf, buf, c); - *sp = str + 1; - return buf; + int len = (*mb_ptr2len)(str); + + // Check for an illegal byte. + if (MB_BYTE2LEN(*str) > len) + { + transchar_nonprint(curbuf, buf, c); + *sp = str + 1; + return buf; + } + *sp = str + len; + p = str; } // Since 'special' is TRUE the multi-byte character 'c' will be // processed by get_special_key_name() - c = (*mb_ptr2char)(str); - *sp = str + len; + c = (*mb_ptr2char)(p); } else *sp = str + 1;