neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 7029b4b44a1cea58af3f54a4d62757b29a8e6aeb
parent 68ddbdd03b0d5884261ab3a7b624195a4a77bd8d
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Tue, 26 Apr 2022 10:09:35 +0800

feat(input): delay all simplifications

Avoid unsimplfied Ctrl-C in input buffer when it is not mapped.

Diffstat:
Msrc/nvim/os/input.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 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;