From eee2fe5b78d903045d92efb33354107d600f8107 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:45:41 +0200 Subject: Clear feedback from current timer --- tests/run.lua | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index c3e7009..cdda346 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6663,7 +6663,40 @@ test("Timer callbacks compare their identity with current state", function() falsy(feedback:handle_highlight_timer(stale)) same(current, state.highlight_timer) truthy(feedback:handle_highlight_timer(current)) - same(current, state.highlight_timer) + same(nil, state.highlight_timer) +end) + +test("Current timer callback clears timer and character overlays", function() + local state, transitions = fresh_sequence_state() + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + configuration = { + mark_char = true, + highlight_timeout_ms = 30, + }, + }) + local feedback = feedback_service.new({ + host = host, + transitions = transitions, + }) + local shared_target = target_plan.build(target("a"), matching_policy()) + local movement = motion_plan.build(shared_target, "f") + local persistent = feedback:request_persistent({ + context = "n", + anchor = domain.Position.new(1, 1), + target_plan = shared_target, + motion_plan = movement, + window = "window-1", + }) + local timer = feedback:start_highlight_timer("window-1") + + truthy(host:fire_timer(timer)) + + same(nil, state.highlight_timer) + same(0, #state.target_overlays) + same(nil, host:highlights()[persistent.identity]) + same(1, #state.finalizers) + falsy(host:timers()[timer].active) end) for _, item in ipairs(tests) do -- cgit v1.2.3