diff src/normal.c @ 203:80000fb16feb

updated for version 7.0060
author vimboss
date Tue, 15 Mar 2005 22:34:55 +0000
parents 476198990769
children da182deebec7
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -172,6 +172,9 @@ static void	nv_nbcmd __ARGS((cmdarg_T *c
 #ifdef FEAT_DND
 static void	nv_drop __ARGS((cmdarg_T *cap));
 #endif
+#ifdef FEAT_AUTOCMD
+static void	nv_cursorhold __ARGS((cmdarg_T *cap));
+#endif
 
 /*
  * Function to be called for a Normal or Visual mode command.
@@ -434,6 +437,9 @@ static const struct nv_cmd
 #ifdef FEAT_DND
     {K_DROP,	nv_drop,	NV_STS,			0},
 #endif
+#ifdef FEAT_AUTOCMD
+    {K_CURSORHOLD, nv_cursorhold, 0,			0},
+#endif
 };
 
 /* Number of commands in nv_cmds[]. */
@@ -1077,6 +1083,9 @@ getcount:
     if (need_flushbuf)
 	out_flush();
 #endif
+#ifdef FEAT_AUTOCMD
+    did_cursorhold = FALSE;
+#endif
 
     State = NORMAL;
 
@@ -8652,3 +8661,20 @@ nv_drop(cap)
     do_put('~', BACKWARD, 1L, PUT_CURSEND);
 }
 #endif
+
+#ifdef FEAT_AUTOCMD
+/*
+ * Trigger CursorHold event.
+ * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the
+ * input buffer.  "did_cursorhold" is set to avoid retriggering.
+ */
+/*ARGSUSED*/
+    static void
+nv_cursorhold(cap)
+    cmdarg_T	*cap;
+{
+    apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);
+    did_cursorhold = TRUE;
+}
+#endif
+