@@ -214,7 +214,6 @@ static void standend(void);
214214static void visual_bell (void );
215215static void cursor_visible (BOOL fVisible );
216216static DWORD write_chars (char_u * pchBuf , DWORD cbToWrite );
217- static WCHAR tgetch (int * pmodifiers , WCHAR * pch2 );
218217static void create_conin (void );
219218static int s_cursor_visible = TRUE;
220219static int did_create_conin = FALSE;
@@ -1502,6 +1501,21 @@ WaitForChar(long msec)
15021501 && (msec < 0 || (long )dwWaitTime > p_mzq ))
15031502 dwWaitTime = p_mzq ; /* don't wait longer than 'mzquantum' */
15041503#endif
1504+ #ifdef FEAT_TIMERS
1505+ {
1506+ long due_time ;
1507+
1508+ /* When waiting very briefly don't trigger timers. */
1509+ if (dwWaitTime > 10 )
1510+ {
1511+ /* Trigger timers and then get the time in msec until the
1512+ * next one is due. Wait up to that time. */
1513+ due_time = check_due_timer ();
1514+ if (due_time > 0 && dwWaitTime > (DWORD )due_time )
1515+ dwWaitTime = due_time ;
1516+ }
1517+ }
1518+ #endif
15051519#ifdef FEAT_CLIENTSERVER
15061520 /* Wait for either an event on the console input or a message in
15071521 * the client-server window. */
@@ -1604,7 +1618,7 @@ create_conin(void)
16041618}
16051619
16061620/*
1607- * Get a keystroke or a mouse event
1621+ * Get a keystroke or a mouse event, use a blocking wait.
16081622 */
16091623 static WCHAR
16101624tgetch (int * pmodifiers , WCHAR * pch2 )
@@ -6074,7 +6088,7 @@ mch_write(
60746088
60756089
60766090/*
6077- * Delay for half a second .
6091+ * Delay for "msec" milliseconds .
60786092 */
60796093/*ARGSUSED*/
60806094 void
0 commit comments