Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
28685:9d93cac8b406 | 28686:141fb1d233ba |
---|---|
1798 special = TRUE; | 1798 special = TRUE; |
1799 } | 1799 } |
1800 | 1800 |
1801 if (has_mbyte && !IS_SPECIAL(c)) | 1801 if (has_mbyte && !IS_SPECIAL(c)) |
1802 { | 1802 { |
1803 int len = (*mb_ptr2len)(str); | 1803 char_u *p; |
1804 | 1804 |
1805 // For multi-byte characters check for an illegal byte. | 1805 *sp = str; |
1806 if (MB_BYTE2LEN(*str) > len) | 1806 // Try to un-escape a multi-byte character after modifiers. |
1807 { | 1807 p = mb_unescape(sp); |
1808 transchar_nonprint(curbuf, buf, c); | 1808 |
1809 *sp = str + 1; | 1809 if (p == NULL) |
1810 return buf; | 1810 { |
1811 int len = (*mb_ptr2len)(str); | |
1812 | |
1813 // Check for an illegal byte. | |
1814 if (MB_BYTE2LEN(*str) > len) | |
1815 { | |
1816 transchar_nonprint(curbuf, buf, c); | |
1817 *sp = str + 1; | |
1818 return buf; | |
1819 } | |
1820 *sp = str + len; | |
1821 p = str; | |
1811 } | 1822 } |
1812 // Since 'special' is TRUE the multi-byte character 'c' will be | 1823 // Since 'special' is TRUE the multi-byte character 'c' will be |
1813 // processed by get_special_key_name() | 1824 // processed by get_special_key_name() |
1814 c = (*mb_ptr2char)(str); | 1825 c = (*mb_ptr2char)(p); |
1815 *sp = str + len; | |
1816 } | 1826 } |
1817 else | 1827 else |
1818 *sp = str + 1; | 1828 *sp = str + 1; |
1819 | 1829 |
1820 // Make unprintable characters in <> form, also <M-Space> and <Tab>. | 1830 // Make unprintable characters in <> form, also <M-Space> and <Tab>. |