aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-02-17 06:33:45 +0800
committerGitHub <noreply@github.com>2022-02-17 06:33:45 +0800
commitb94b11623622abc607ed86a2ad148d6134f80d15 (patch)
tree67a2804c04a509847da7f7b5121c274f84534419
parent4646ea1079de484c4217006f94c565ea508f2f40 (diff)
parent9c5228f3e76a3b096c29d95fd2f5b4f45e4cfb7e (diff)
downloadrneovim-b94b11623622abc607ed86a2ad148d6134f80d15.tar.gz
rneovim-b94b11623622abc607ed86a2ad148d6134f80d15.tar.bz2
rneovim-b94b11623622abc607ed86a2ad148d6134f80d15.zip
Merge pull request #17429 from zeertzjq/vim-8.2.4400
vim-patch:8.2.{4392,4394,4400}
-rw-r--r--src/nvim/getchar.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 6978823f2b..741fc6d803 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1004,20 +1004,9 @@ int ins_char_typebuf(int c, int modifier)
buf[len + 2] = (char_u)K_THIRD(c);
buf[len + 3] = NUL;
} else {
- char_u *p = buf + len;
- int char_len = utf_char2bytes(c, p);
- len += char_len;
- // If the character contains K_SPECIAL bytes they need escaping.
- for (int i = char_len; --i >= 0; p++) {
- if ((uint8_t)(*p) == K_SPECIAL) {
- memmove(p + 3, p + 1, (size_t)i);
- *p++ = K_SPECIAL;
- *p++ = KS_SPECIAL;
- *p = KE_FILLER;
- len += 2;
- }
- }
- *p = NUL;
+ char_u *end = add_char2buf(c, buf + len);
+ *end = NUL;
+ len = (int)(end - buf);
}
(void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
return len;