mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
Merge pull request #23313 from zeertzjq/vim-8.2.3768
vim-patch:8.2.{3768,3772}
This commit is contained in:
commit
c111460b1a
@ -6002,7 +6002,7 @@ void add_timer_info_all(typval_T *rettv)
|
|||||||
tv_list_alloc_ret(rettv, map_size(&timers));
|
tv_list_alloc_ret(rettv, map_size(&timers));
|
||||||
timer_T *timer;
|
timer_T *timer;
|
||||||
map_foreach_value(&timers, timer, {
|
map_foreach_value(&timers, timer, {
|
||||||
if (!timer->stopped) {
|
if (!timer->stopped || timer->refcount > 1) {
|
||||||
add_timer_info(rettv, timer);
|
add_timer_info(rettv, timer);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -8944,7 +8944,7 @@ static void f_timer_info(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
}
|
}
|
||||||
tv_list_alloc_ret(rettv, 1);
|
tv_list_alloc_ret(rettv, 1);
|
||||||
timer_T *timer = find_timer_by_nr(tv_get_number(&argvars[0]));
|
timer_T *timer = find_timer_by_nr(tv_get_number(&argvars[0]));
|
||||||
if (timer != NULL && !timer->stopped) {
|
if (timer != NULL && (!timer->stopped || timer->refcount > 1)) {
|
||||||
add_timer_info(rettv, timer);
|
add_timer_info(rettv, timer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,6 +94,12 @@ func Test_timer_info()
|
|||||||
call assert_equal([], timer_info(id))
|
call assert_equal([], timer_info(id))
|
||||||
|
|
||||||
call assert_fails('call timer_info("abc")', 'E39:')
|
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})
|
||||||
|
call WaitForAssert({-> assert_equal([2, 1, 0], g:timer_repeat)})
|
||||||
|
unlet g:timer_repeat
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_timer_stopall()
|
func Test_timer_stopall()
|
||||||
|
Loading…
Reference in New Issue
Block a user