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)
diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim
index 865a03b..c833dd8 100644
--- a/src/testdir/test_timers.vim
+++ b/src/testdir/test_timers.vim
@@ -117,6 +117,13 @@
call assert_equal([], timer_info(id))
call assert_fails('call timer_info("abc")', 'E39:')
+
+ " check repeat count inside the callback
+ let g:timer_repeat = []
+ let tid = timer_start(10, {tid -> execute("call add(g:timer_repeat, timer_info(tid)[0].repeat)")}, #{repeat: 3})
+ sleep 100m
+ call assert_equal([2, 1, 0], g:timer_repeat)
+ unlet g:timer_repeat
endfunc
func Test_timer_stopall()