fix(input): never escape CSI bytes

This commit is contained in:
zeertzjq
2022-01-21 18:08:56 +08:00
parent c977d8b43c
commit ff7c3d1275
3 changed files with 28 additions and 14 deletions

View File

@@ -1010,12 +1010,11 @@ void ins_char_typebuf(int c)
buf[utf_char2bytes(c, buf)] = NUL;
char_u *p = buf;
while (*p) {
if ((uint8_t)(*p) == CSI || (uint8_t)(*p) == K_SPECIAL) {
bool is_csi = (uint8_t)(*p) == CSI;
if ((uint8_t)(*p) == K_SPECIAL) {
memmove(p + 3, p + 1, STRLEN(p + 1) + 1);
*p++ = K_SPECIAL;
*p++ = is_csi ? KS_EXTRA : KS_SPECIAL;
*p++ = is_csi ? KE_CSI : KE_FILLER;
*p++ = KS_SPECIAL;
*p++ = KE_FILLER;
} else {
p++;
}