diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-26 10:09:35 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-29 15:51:03 +0800 |
commit | 7029b4b44a1cea58af3f54a4d62757b29a8e6aeb (patch) | |
tree | 22a0b43e3f59dbeebcb35767f4f8d97d266f46bb /src | |
parent | 68ddbdd03b0d5884261ab3a7b624195a4a77bd8d (diff) | |
download | rneovim-7029b4b44a1cea58af3f54a4d62757b29a8e6aeb.tar.gz rneovim-7029b4b44a1cea58af3f54a4d62757b29a8e6aeb.tar.bz2 rneovim-7029b4b44a1cea58af3f54a4d62757b29a8e6aeb.zip |
feat(input): delay all simplifications
Avoid unsimplfied Ctrl-C in input buffer when it is not mapped.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/input.c | 10 |
1 files changed, 8 insertions, 2 deletions
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; |