From 1c2e6fc2638a57336ca0a2e5ae1fbe8015fc3dc3 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:45:58 +0200 Subject: Preserve timer-cleaned movement history --- tests/run.lua | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index cdda346..0e33c03 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6699,6 +6699,45 @@ test("Current timer callback clears timer and character overlays", function() falsy(host:timers()[timer].active) end) +test("Timer cleanup preserves primary movement history", function() + local state, transitions = fresh_sequence_state() + local landing = domain.Position.new(1, 3) + local target_value = target("a") + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + configuration = { + mark_char = true, + highlight_timeout_ms = 20, + }, + }) + local feedback = feedback_service.new({ + host = host, + transitions = transitions, + }) + local shared_target = target_plan.build(target_value, matching_policy()) + local movement = motion_plan.build(shared_target, "f") + transitions:BeginAcquisition("n", "f") + transitions:CommitAcquiredTarget("n", target_value) + transitions:CommitCommandSuccess("n", landing, true) + 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") + + host:fire_timer(timer) + + same(domain.Descriptor.FIND_FORWARD, state:get_previous_descriptor("n")) + same(target_value, state:get_previous_target("n")) + same(landing, state:get_previous_landing("n")) + falsy(state:get_first_move("n")) + truthy(state.moved_forward) + same(domain.ModeContext.from_full_mode("n"), state.last_input_context) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3