0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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 #10351)
This commit is contained in:
zeertzjq
2022-05-04 18:51:43 +01:00
committed by Bram Moolenaar
parent 47d4e317f8
commit ac402f4d64
4 changed files with 41 additions and 19 deletions

View File

@@ -1800,19 +1800,29 @@ str2special(
if (has_mbyte && !IS_SPECIAL(c))
{
int len = (*mb_ptr2len)(str);
char_u *p;
// For multi-byte characters check for an illegal byte.
if (MB_BYTE2LEN(*str) > len)
*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;