Mercurial > vim
diff src/ex_cmds2.c @ 9810:6a28d0c6f929 v7.4.2180
commit https://github.com/vim/vim/commit/b73598e2f022a22fec512ea681c70d2775e8fd87
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 7 18:22:53 2016 +0200
patch 7.4.2180
Problem: There is no easy way to stop all timers. There is no way to
temporary pause a timer.
Solution: Add timer_stopall() and timer_pause().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 07 Aug 2016 18:30:05 +0200 |
parents | 711b42c1013b |
children | 939a8f55aea0 |
line wrap: on
line diff
--- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1189,6 +1189,8 @@ check_due_timer(void) next_due = -1; for (timer = first_timer; timer != NULL; timer = timer->tr_next) { + if (timer->tr_paused) + continue; # ifdef WIN3264 this_due = (long)(((double)(timer->tr_due.QuadPart - now.QuadPart) / (double)fr.QuadPart) * 1000); @@ -1252,6 +1254,15 @@ stop_timer(timer_T *timer) } void +stop_all_timers(void) +{ + timer_T *timer; + + while (first_timer != NULL) + stop_timer(first_timer); +} + + void add_timer_info(typval_T *rettv, timer_T *timer) { list_T *list = rettv->vval.v_list; @@ -1283,6 +1294,7 @@ add_timer_info(typval_T *rettv, timer_T dict_add_nr_str(dict, "repeat", (long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1), NULL); + dict_add_nr_str(dict, "paused", (long)(timer->tr_paused), NULL); di = dictitem_alloc((char_u *)"callback"); if (di != NULL)