comparison src/map.c @ 24559:839145e0fdaa v8.2.2819

patch 8.2.2819: finishing an abbreviation with multi-byte char may not work Commit: https://github.com/vim/vim/commit/4934ed34c3e2090d1963c89c629cd3ce81d3ecd1 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Apr 30 19:43:11 2021 +0200 patch 8.2.2819: finishing an abbreviation with multi-byte char may not work Problem: Finishing an abbreviation with a multi-byte char may not work. Solution: Escape K_SPECIAL in the typed character. (closes https://github.com/vim/vim/issues/8160)
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Apr 2021 19:45:04 +0200
parents db2b4e867d06
children 3a3d5ee00574
comparison
equal deleted inserted replaced
24558:9a6a4aa70490 24559:839145e0fdaa
1538 { 1538 {
1539 if (c < ABBR_OFF && (c < ' ' || c > '~')) 1539 if (c < ABBR_OFF && (c < ' ' || c > '~'))
1540 tb[j++] = Ctrl_V; // special char needs CTRL-V 1540 tb[j++] = Ctrl_V; // special char needs CTRL-V
1541 if (has_mbyte) 1541 if (has_mbyte)
1542 { 1542 {
1543 int newlen;
1544 char_u *escaped;
1545
1543 // if ABBR_OFF has been added, remove it here 1546 // if ABBR_OFF has been added, remove it here
1544 if (c >= ABBR_OFF) 1547 if (c >= ABBR_OFF)
1545 c -= ABBR_OFF; 1548 c -= ABBR_OFF;
1546 j += (*mb_char2bytes)(c, tb + j); 1549 newlen = (*mb_char2bytes)(c, tb + j);
1550 tb[j + newlen] = NUL;
1551 // Need to escape K_SPECIAL.
1552 escaped = vim_strsave_escape_csi(tb + j);
1553 if (escaped != NULL)
1554 {
1555 newlen = STRLEN(escaped);
1556 mch_memmove(tb + j, escaped, newlen);
1557 j += newlen;
1558 vim_free(escaped);
1559 }
1547 } 1560 }
1548 else 1561 else
1549 tb[j++] = c; 1562 tb[j++] = c;
1550 } 1563 }
1551 tb[j] = NUL; 1564 tb[j] = NUL;