patch 8.2.3768: timer_info() has the wrong repeat value in a timer callback

Problem:    timer_info() has the wrong repeat value in a timer callback.
Solution:   Do not add one to the repeat value when in the callback.
            (closes #9294)
This commit is contained in:
Bram Moolenaar
2021-12-09 18:42:57 +00:00
parent e8a92b6166
commit 95b2dd0c00
3 changed files with 11 additions and 1 deletions

View File

@ -696,7 +696,8 @@ add_timer_info(typval_T *rettv, timer_T *timer)
dict_add_number(dict, "remaining", (long)remaining);
dict_add_number(dict, "repeat",
(long)(timer->tr_repeat < 0 ? -1 : timer->tr_repeat + 1));
(long)(timer->tr_repeat < 0 ? -1
: timer->tr_repeat + (timer->tr_firing ? 0 : 1)));
dict_add_number(dict, "paused", (long)(timer->tr_paused));
di = dictitem_alloc((char_u *)"callback");