diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-06-24 16:03:06 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-06-24 16:03:06 +0200 |
commit | 1e8e14552e0cc8881411eb8fbe39a654dae42554 (patch) | |
tree | f28d457d94b1ac4db1fe700f23bb31d428e674d5 /src/ex_cmds2.c | |
parent | 24a9e348aa88a6c60ae0cdf5c4a777d8c03b08ca (diff) |
patch 8.0.0670: can't use input() in a timer callbackv8.0.0670
Problem: Can't use input() in a timer callback. (Cosmin Popescu)
Solution: Reset vgetc_busy and set timer_busy. (Ozaki Kiichi, closes #1790,
closes #1129)
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r-- | src/ex_cmds2.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 225225a78c..33ad924d22 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1209,11 +1209,18 @@ check_due_timer(void) this_due = GET_TIMEDIFF(timer, now); if (this_due <= 1) { + int save_timer_busy = timer_busy; + int save_vgetc_busy = vgetc_busy; + + timer_busy = timer_busy > 0 || vgetc_busy > 0; + vgetc_busy = 0; timer->tr_firing = TRUE; timer_callback(timer); timer->tr_firing = FALSE; timer_next = timer->tr_next; did_one = TRUE; + timer_busy = save_timer_busy; + vgetc_busy = save_vgetc_busy; /* Only fire the timer again if it repeats and stop_timer() wasn't * called while inside the callback (tr_id == -1). */ |