aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-10-05 10:13:18 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-10-26 10:52:01 -0300
commite5165bae1139221ef752bccd582c7bd7474e6747 (patch)
tree42799e7a113b8e441bb14df724d4dece73974b1d /src/nvim/edit.c
parentd8055f8eab7b1c3fb90f69e9795e9e2a88d0cd68 (diff)
downloadrneovim-e5165bae1139221ef752bccd582c7bd7474e6747.tar.gz
rneovim-e5165bae1139221ef752bccd582c7bd7474e6747.tar.bz2
rneovim-e5165bae1139221ef752bccd582c7bd7474e6747.zip
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.
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c23
1 files changed, 9 insertions, 14 deletions
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: /* <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)