diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-19 14:11:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-19 14:11:18 +0100 |
commit | 943bb2b8eb80266a5de143feeab4c842c4b68c61 (patch) | |
tree | 3ff2a40e1736da58afc66c2a33098718c40cef6c | |
parent | a889cf4642a89537e3eeecf6d30326bf6aa4776f (diff) | |
download | vim-git-943bb2b8eb80266a5de143feeab4c842c4b68c61.tar.gz |
patch 7.4.1594v7.4.1594
Problem: Timers don't work on Unix.
Solution: Add missing code.
-rw-r--r-- | src/os_unix.c | 42 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 42 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index f2ae513cf..a9c20c991 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -176,6 +176,7 @@ typedef int waitstatus; static pid_t wait4pid(pid_t, waitstatus *); static int WaitForChar(long); +static int WaitForCharOrMouse(long); #if defined(__BEOS__) || defined(VMS) int RealWaitForChar(int, long, int *); #else @@ -5347,13 +5348,50 @@ mch_breakcheck(void) } /* - * Wait "msec" msec until a character is available from the keyboard or from - * inbuf[]. msec == -1 will block forever. + * Wait "msec" msec until a character is available from the mouse, keyboard, + * from inbuf[]. + * "msec" == -1 will block forever. + * Invokes timer callbacks when needed. * When a GUI is being used, this will never get called -- webb */ static int WaitForChar(long msec) { +#ifdef FEAT_TIMERS + long due_time; + long remaining = msec; + + /* When waiting very briefly don't trigger timers. */ + if (msec >= 0 && msec < 10L) + return WaitForCharOrMouse(msec); + + while (msec < 0 || remaining > 0) + { + /* 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 || (msec > 0 && due_time > remaining)) + due_time = remaining; + if (WaitForCharOrMouse(due_time)) + return TRUE; + if (msec > 0) + remaining -= due_time; + } + return FALSE; +#else + return WaitForCharOrMouse(msec); +#endif +} + +/* + * Wait "msec" msec until a character is available from the mouse or keyboard + * or from inbuf[]. + * "msec" == -1 will block forever. + * When a GUI is being used, this will never get called -- webb + */ + static int +WaitForCharOrMouse(long msec) +{ #ifdef FEAT_MOUSE_GPM int gpm_process_wanted; #endif diff --git a/src/version.c b/src/version.c index 449c8f24e..06cec58dd 100644 --- a/src/version.c +++ b/src/version.c @@ -749,6 +749,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1594, +/**/ 1593, /**/ 1592, |