From e5165bae1139221ef752bccd582c7bd7474e6747 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Mon, 5 Oct 2015 10:13:18 -0300 Subject: input: Remove CURSORHOLD key Refactor input.c, normal.c and edit.c to use the K_EVENT special key to trigger the CURSORHOLD event. In normal and edit mode, K_EVENT is treated as K_CURSORHOLD, which enables better handling of arbitrary actions in those states(eg: In normal mode the previous operator counts will be restored). Also fix a test in vim_spec.lua. The test had a wrong assumption: cmdheight is only used to determine when the press enter screen will be shown, not to limit how many lines or control pagination. --- src/nvim/edit.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/nvim/edit.c') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index b2f9601f82..67dbf8483b 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -626,14 +626,9 @@ edit ( } while (c == K_IGNORE); input_disable_events(); - if (c == K_EVENT) { - c = lastc; - queue_process_events(loop.events); - continue; - } - - /* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */ - did_cursorhold = TRUE; + // Don't want K_EVENT with cursorhold for the second key, e.g., after + // CTRL-V. + did_cursorhold = true; if (p_hkmap && KeyTyped) c = hkmap(c); /* Hebrew mode mapping */ @@ -974,9 +969,8 @@ doESCkey: case K_IGNORE: /* Something mapped to nothing */ break; - case K_CURSORHOLD: /* Didn't type something for a while. */ - apply_autocmds(EVENT_CURSORHOLDI, NULL, NULL, FALSE, curbuf); - did_cursorhold = TRUE; + case K_EVENT: // some event + queue_process_events(loop.events); break; case K_HOME: /* */ @@ -1223,9 +1217,10 @@ normalchar: break; } /* end of switch (c) */ - /* If typed something may trigger CursorHoldI again. */ - if (c != K_CURSORHOLD) - did_cursorhold = FALSE; + // If typed something may trigger CursorHoldI again. + if (c != K_EVENT) { + did_cursorhold = false; + } /* If the cursor was moved we didn't just insert a space */ if (arrow_used) -- cgit