Mercurial > vim
comparison src/testdir/test_timers.vim @ 26476:7426c2657710 v8.2.3768
patch 8.2.3768: timer_info() has the wrong repeat value in a timer callback
Commit: https://github.com/vim/vim/commit/95b2dd0c008f0977ebb3cbe233a5064001a332e1
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 9 18:42:57 2021 +0000
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 09 Dec 2021 19:45:03 +0100 |
parents | a5a772dace5b |
children | d945799b4604 |
comparison
equal
deleted
inserted
replaced
26475:9f535da74f6f | 26476:7426c2657710 |
---|---|
115 | 115 |
116 call timer_stop(id) | 116 call timer_stop(id) |
117 call assert_equal([], timer_info(id)) | 117 call assert_equal([], timer_info(id)) |
118 | 118 |
119 call assert_fails('call timer_info("abc")', 'E39:') | 119 call assert_fails('call timer_info("abc")', 'E39:') |
120 | |
121 " check repeat count inside the callback | |
122 let g:timer_repeat = [] | |
123 let tid = timer_start(10, {tid -> execute("call add(g:timer_repeat, timer_info(tid)[0].repeat)")}, #{repeat: 3}) | |
124 sleep 100m | |
125 call assert_equal([2, 1, 0], g:timer_repeat) | |
126 unlet g:timer_repeat | |
120 endfunc | 127 endfunc |
121 | 128 |
122 func Test_timer_stopall() | 129 func Test_timer_stopall() |
123 let id1 = timer_start(1000, 'MyHandler') | 130 let id1 = timer_start(1000, 'MyHandler') |
124 let id2 = timer_start(2000, 'MyHandler') | 131 let id2 = timer_start(2000, 'MyHandler') |