diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-30 19:43:11 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-30 19:43:11 +0200 |
commit | 4934ed34c3e2090d1963c89c629cd3ce81d3ecd1 (patch) | |
tree | c3eed83db5c0981fddeeb7825c0a5da7bb13379d /src/map.c | |
parent | aeed2a6359e9ca692e1397884c3678685132d360 (diff) | |
download | vim-git-4934ed34c3e2090d1963c89c629cd3ce81d3ecd1.tar.gz |
patch 8.2.2819: finishing an abbreviation with multi-byte char may not workv8.2.2819
Problem: Finishing an abbreviation with a multi-byte char may not work.
Solution: Escape K_SPECIAL in the typed character. (closes #8160)
Diffstat (limited to 'src/map.c')
-rw-r--r-- | src/map.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1540,10 +1540,23 @@ check_abbr( tb[j++] = Ctrl_V; // special char needs CTRL-V if (has_mbyte) { + int newlen; + char_u *escaped; + // if ABBR_OFF has been added, remove it here if (c >= ABBR_OFF) c -= ABBR_OFF; - j += (*mb_char2bytes)(c, tb + j); + newlen = (*mb_char2bytes)(c, tb + j); + tb[j + newlen] = NUL; + // Need to escape K_SPECIAL. + escaped = vim_strsave_escape_csi(tb + j); + if (escaped != NULL) + { + newlen = STRLEN(escaped); + mch_memmove(tb + j, escaped, newlen); + j += newlen; + vim_free(escaped); + } } else tb[j++] = c; |