0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.0.0670: can't use input() in a timer callback

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)
This commit is contained in:
Bram Moolenaar
2017-06-24 16:03:06 +02:00
parent 24a9e348aa
commit 1e8e14552e
5 changed files with 27 additions and 1 deletions

View File

@@ -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). */