updated for version 7.0060
diff --git a/src/os_win32.c b/src/os_win32.c
index a50f5d9..30a3e8e 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1323,9 +1323,6 @@
int len;
int c;
-#ifdef FEAT_AUTOCMD
- static int once_already = 0;
-#endif
#define TYPEAHEADLEN 20
static char_u typeahead[TYPEAHEADLEN]; /* previously typed bytes. */
static int typeaheadlen = 0;
@@ -1358,40 +1355,29 @@
if (time >= 0)
{
if (!WaitForChar(time)) /* no character available */
- {
-#ifdef FEAT_AUTOCMD
- once_already = 0;
-#endif
return 0;
- }
}
else /* time == -1, wait forever */
{
mch_set_winsize_now(); /* Allow winsize changes from now on */
-#ifdef FEAT_AUTOCMD
- /* If there is no character available within 2 seconds (default),
- * write the autoscript file to disk */
- if (once_already == 2)
- updatescript(0);
- else if (once_already == 1)
- {
- setcursor();
- once_already = 2;
- return 0;
- }
- else
-#endif
- if (!WaitForChar(p_ut))
+ /*
+ * If there is no character available within 2 seconds (default)
+ * write the autoscript file to disk. Or cause the CursorHold event
+ * to be triggered.
+ */
+ if (!WaitForChar(p_ut))
{
#ifdef FEAT_AUTOCMD
- if (has_cursorhold() && get_real_state() == NORMAL_BUSY)
+ if (!did_cursorhold && has_cursorhold()
+ && get_real_state() == NORMAL_BUSY && maxlen >= 3)
{
- apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);
- update_screen(VALID);
- once_already = 1;
- return 0;
+ buf[0] = K_SPECIAL;
+ buf[1] = KS_EXTRA;
+ buf[2] = (int)KE_CURSORHOLD;
+ return 3;
}
+ else
#endif
updatescript(0);
}
@@ -1528,10 +1514,6 @@
}
#endif
-#ifdef FEAT_AUTOCMD
- once_already = 0;
-#endif
-
theend:
/* Move typeahead to "buf", as much as fits. */
len = 0;