mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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().
This commit is contained in:
@@ -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);
|
||||
@@ -1251,6 +1253,15 @@ stop_timer(timer_T *timer)
|
||||
free_timer(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)
|
||||
{
|
||||
@@ -1283,6 +1294,7 @@ add_timer_info(typval_T *rettv, timer_T *timer)
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user