From 0df9949734b3e39893c75839ba84c4b858acb274 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:37:56 +0200 Subject: Preserve matching cursor sequence --- tests/run.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index 902d846..baa8f29 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6159,6 +6159,40 @@ test("CursorMoved compares the actual cursor with the last-input landing", funct falsy(different.equal) end) +test("Matching CursorMoved preserves the active sequence", function() + local state, transitions = fresh_sequence_state() + local landing = domain.Position.new(1, 3) + local host = MemoryHost.new({ + buffer_lines = { "aba" }, + cursor = landing, + }) + 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") + transitions:BeginAcquisition("n", "f") + transitions:CommitAcquiredTarget("n", target("a")) + feedback:request_persistent({ + context = "n", + anchor = domain.Position.new(1, 1), + target_plan = shared_target, + motion_plan = movement, + window = "window-1", + }) + transitions:CommitCommandSuccess("n", landing, true) + local before = state:snapshot() + + host:deliver_event("CursorMoved", { cursor = landing }) + + same(before.previous_descriptor[domain.ModeContext.from_full_mode("n")], + state:get_previous_descriptor("n")) + same(landing, state:get_previous_landing("n")) + same(1, #state.target_overlays) + same(1, #state.finalizers) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3