Merge pull request #17429 from zeertzjq/vim-8.2.4400

vim-patch:8.2.{4392,4394,4400}
This commit is contained in:
zeertzjq
2022-02-17 06:33:45 +08:00
committed by GitHub

View File

@@ -1004,20 +1004,9 @@ int ins_char_typebuf(int c, int modifier)
buf[len + 2] = (char_u)K_THIRD(c); buf[len + 2] = (char_u)K_THIRD(c);
buf[len + 3] = NUL; buf[len + 3] = NUL;
} else { } else {
char_u *p = buf + len; char_u *end = add_char2buf(c, buf + len);
int char_len = utf_char2bytes(c, p); *end = NUL;
len += char_len; len = (int)(end - buf);
// 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;
} }
(void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent); (void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
return len; return len;