commit b95e0a8d20b73ec1989a373b76b9b0e828ad540f
parent 396edf1e463e79d61a5502f56e9615a71e691ed8
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 5 Feb 2026 14:27:15 +0800
test(terminal/cursor_spec): fix flaky test (#37715)
Problem: Cursor visibility test may fail if the :sleep lasts too long.
Solution: Wait for the TermLeave autocommand to finish.
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua
@@ -143,13 +143,19 @@ describe(':terminal cursor', function()
-- Cursor is hidden; now request to show it while in a TermLeave autocmd.
-- Process events (via :sleep) to handle the escape sequence now.
- command([[autocmd TermLeave * ++once call chansend(&channel, "\e[?25h") | sleep 1m]])
+ n.exec([[
+ autocmd TermLeave * ++once call chansend(&channel, "\e[?25h") | sleep 1m
+ \ | let g:did_termleave = 1]])
feed([[<C-\><C-N>]]) -- Exit terminal mode; cursor should not remain hidden
screen:expect([[
tty ready |
^ |
|*5
]])
+ -- Wait for the TermLeave autocommand to finish. Sometimes :sleep can be slow.
+ retry(nil, 1000, function()
+ eq(1, api.nvim_get_var('did_termleave'))
+ end)
command('bwipeout! | let chan = nvim_open_term(0, {})')
feed('i')