From 7029b4b44a1cea58af3f54a4d62757b29a8e6aeb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 26 Apr 2022 10:09:35 +0800 Subject: feat(input): delay all simplifications Avoid unsimplfied Ctrl-C in input buffer when it is not mapped. --- src/nvim/os/input.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index 4c617c9031..a4b8735b9e 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -238,8 +238,9 @@ size_t input_enqueue(String keys) // but since the keys are UTF-8, so the first byte cannot be // K_SPECIAL(0x80). uint8_t buf[19] = { 0 }; + // Do not simplify the keys here. Simplification will be done later. unsigned int new_size - = trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true, false, true, NULL); + = trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true, false, false, NULL); if (new_size) { new_size = handle_mouse_event(&ptr, buf, new_size); @@ -487,7 +488,12 @@ static void process_interrupts(void) size_t consume_count = 0; RBUFFER_EACH_REVERSE(input_buffer, c, i) { - if ((uint8_t)c == Ctrl_C) { + if ((uint8_t)c == Ctrl_C + || ((uint8_t)c == 'C' && i >= 3 + && (uint8_t)(*rbuffer_get(input_buffer, i - 3)) == K_SPECIAL + && (uint8_t)(*rbuffer_get(input_buffer, i - 2)) == KS_MODIFIER + && (uint8_t)(*rbuffer_get(input_buffer, i - 1)) == MOD_MASK_CTRL)) { + *rbuffer_get(input_buffer, i) = Ctrl_C; got_int = true; consume_count = i; break; -- cgit