Mercurial > vim
diff src/ex_cmds2.c @ 11575:0ec755ff1fe2 v8.0.0670
patch 8.0.0670: can't use input() in a timer callback
commit https://github.com/vim/vim/commit/1e8e14552e0cc8881411eb8fbe39a654dae42554
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 24 16:03:06 2017 +0200
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 https://github.com/vim/vim/issues/1790,
closes #1129)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 24 Jun 2017 16:15:03 +0200 |
parents | 5a1656d79707 |
children | 42cd59477698 |
line wrap: on
line diff
--- 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). */