diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-17 17:58:56 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-17 17:58:56 +0100 |
commit | 0e0b3dd335b863603b9a2d415ef18d983e2467ae (patch) | |
tree | 49f4b8c059aca96300b8dfc0cf950b88f2659996 /src/os_win32.c | |
parent | 597385ab43093ba27adcb86cdc1b46aba86a0093 (diff) | |
download | vim-git-0e0b3dd335b863603b9a2d415ef18d983e2467ae.tar.gz |
patch 7.4.1584v7.4.1584
Problem: Timers don't work for Win32 console.
Solution: Add check_due_timer() in WaitForChar().
Diffstat (limited to 'src/os_win32.c')
-rw-r--r-- | src/os_win32.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index d7b563459..627d515dd 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -214,7 +214,6 @@ static void standend(void); static void visual_bell(void); static void cursor_visible(BOOL fVisible); static DWORD write_chars(char_u *pchBuf, DWORD cbToWrite); -static WCHAR tgetch(int *pmodifiers, WCHAR *pch2); static void create_conin(void); static int s_cursor_visible = TRUE; static int did_create_conin = FALSE; @@ -1502,6 +1501,21 @@ WaitForChar(long msec) && (msec < 0 || (long)dwWaitTime > p_mzq)) dwWaitTime = p_mzq; /* don't wait longer than 'mzquantum' */ #endif +#ifdef FEAT_TIMERS + { + long due_time; + + /* When waiting very briefly don't trigger timers. */ + if (dwWaitTime > 10) + { + /* Trigger timers and then get the time in msec until the + * next one is due. Wait up to that time. */ + due_time = check_due_timer(); + if (due_time > 0 && dwWaitTime > (DWORD)due_time) + dwWaitTime = due_time; + } + } +#endif #ifdef FEAT_CLIENTSERVER /* Wait for either an event on the console input or a message in * the client-server window. */ @@ -1604,7 +1618,7 @@ create_conin(void) } /* - * Get a keystroke or a mouse event + * Get a keystroke or a mouse event, use a blocking wait. */ static WCHAR tgetch(int *pmodifiers, WCHAR *pch2) @@ -6074,7 +6088,7 @@ mch_write( /* - * Delay for half a second. + * Delay for "msec" milliseconds. */ /*ARGSUSED*/ void |