From 80496b38064f1abde2b5870955bd73b7d3a3d794 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 10:22:02 +0200 Subject: Adjust exclusive FIND destinations --- tests/run.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index e045a7e..4872cfd 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2417,6 +2417,33 @@ test("Backward TILL destinations use target successors", function() truthy(cross_line_view:is_valid_cursor_position(cross_line.endpoint)) end) +test("Forward Visual-exclusive FIND uses target successors", function() + local view = text_topology.new({ "abx", "cd" }, "utf-8") + local engine = destination_engine.new() + local target_match = target_plan.build(target("x"), matching_policy()) + local regular = motion_plan.build( + target_match, + "f", + "buffer", + domain.EndpointPolicy.REGULAR + ) + local exclusive = motion_plan.build( + target_match, + "f", + "buffer", + domain.EndpointPolicy.VISUAL_EXCLUSIVE + ) + local origin = domain.Position.new(1, 1) + + same( + domain.Position.new(1, 3), + engine:calculate(view, origin, regular, 1, true).endpoint + ) + local adjusted = engine:calculate(view, origin, exclusive, 1, true) + same(domain.Position.new(2, 1), adjusted.endpoint) + truthy(view:is_valid_cursor_position(adjusted.endpoint)) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3