From 86fbcd67be123a1894611ad90de73d413e92eda1 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 20 Jul 2026 11:12:53 -0400 Subject: [PATCH] test: unreliable "CursorHold not triggered after only K_EVENT on startup" #40863 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: FAILED …/cursorhold_spec.lua @ 73: CursorHold is not triggered after only K_EVENT on startup Expected values to be equal. Expected: 1 Actual: 0 stack traceback: …/cursorhold_spec.lua:79: in function <…/cursorhold_spec.lua:73> Solution: Retry instead of hardcoding sleep(50). --- test/functional/autocmd/cursorhold_spec.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/functional/autocmd/cursorhold_spec.lua b/test/functional/autocmd/cursorhold_spec.lua index 178ed69833..3c030d2911 100644 --- a/test/functional/autocmd/cursorhold_spec.lua +++ b/test/functional/autocmd/cursorhold_spec.lua @@ -75,8 +75,10 @@ describe('CursorHold', function() sleep(50) eq(0, api.nvim_get_var('cursorhold')) feed('0') - sleep(50) - eq(1, api.nvim_get_var('cursorhold')) + -- Poll: CursorHold may take longer than one 'updatetime' to fire. + retry(nil, 1000, function() + eq(1, api.nvim_get_var('cursorhold')) + end) end) end)