patch 9.1.1402: multi-byte mappings not properly stored in session file

Problem:  multi-byte mappings not properly stored in session file
Solution: unescape the mapping before writing out the mapping, prefer
          single-byte mapping name if possible (Miguel Barro)

closes: #17355

Signed-off-by: GuyBrush <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
GuyBrush
2025-05-22 22:19:25 +02:00
committed by Christian Brabandt
parent 1a8be6b447
commit 5b07aff2f6
4 changed files with 50 additions and 5 deletions

View File

@ -1213,7 +1213,7 @@ handle_x_keys(int key)
get_special_key_name(int c, int modifiers)
{
static char_u string[MAX_KEY_NAME_LEN + 1];
int i, idx;
int i, idx, len;
int table_idx;
string[0] = '<';
@ -1286,10 +1286,11 @@ get_special_key_name(int c, int modifiers)
// Not a special key, only modifiers, output directly
else
{
if (has_mbyte && (*mb_char2len)(c) > 1)
idx += (*mb_char2bytes)(c, string + idx);
else if (vim_isprintc(c))
len = (*mb_char2len)(c);
if (len == 1 && vim_isprintc(c))
string[idx++] = c;
else if (has_mbyte && len > 1)
idx += (*mb_char2bytes)(c, string + idx);
else
{
char_u *s = transchar(c);