From f43bc1874ecb8a2b8230e3af82a5a28170bfd810 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:43:25 +0200 Subject: Retain Visual feedback anchor --- tests/run.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index e9c91b1..c626444 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6517,6 +6517,50 @@ test("Direction-changing repeated TILL rebuilds feedback", function() same(1, #state.target_overlays) end) +test("Visual movement retains its persistent feedback anchor", function() + local state, transitions = fresh_sequence_state() + local origin = domain.Position.new(1, 1) + local host = MemoryHost.new({ + buffer_lines = { "a", "x" }, + cursor = origin, + mode = "v", + selection = domain.Selection.active( + domain.SelectionKind.CHARACTER, + origin, + origin, + domain.SelectionOption.INCLUSIVE + ), + }) + local feedback = feedback_service.new({ + host = host, + transitions = transitions, + }) + local shared_target = target_plan.build(target("x"), matching_policy()) + local movement = motion_plan.build(shared_target, "f") + transitions:BeginAcquisition("v", "f") + transitions:CommitAcquiredTarget("v", target("x")) + local persistent = feedback:request_persistent({ + context = "v", + anchor = origin, + target_plan = shared_target, + motion_plan = movement, + window = "window-1", + }) + local token = host:begin_action_transition() + local outcome = motion_executor.new({ + host = host, + feedback_service = feedback, + transitions = transitions, + }):execute(text_topology.from_host(host), "v", movement, 1, true) + host:commit_action_transition(token) + + same(domain.ActionKind.MOVEMENT, outcome.kind) + same(domain.Position.new(2, 1), state:get_previous_landing("v")) + same(persistent.identity, state.target_overlays[1].identity) + same(1, state.target_overlays[1].anchor_line) + truthy(host:highlights()[persistent.identity] ~= nil) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3