From 1a9f90afcc6e5e00a94dd188a5361a894d06e257 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 10:21:30 +0200 Subject: Transform backward TILL destinations --- tests/run.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index e11bf1f..e045a7e 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -2383,6 +2383,40 @@ test("Forward TILL destinations use target predecessors", function() truthy(view:is_valid_cursor_position(cross_line.endpoint)) end) +test("Backward TILL destinations use target successors", function() + local engine = destination_engine.new() + local same_line_view = text_topology.new({ "xabx" }, "utf-8") + local till_a = motion_plan.build( + target_plan.build(target("a"), matching_policy()), + "T" + ) + same( + domain.Position.new(1, 3), + engine:calculate( + same_line_view, + domain.Position.new(1, 4), + till_a, + 1, + true + ).endpoint + ) + + local cross_line_view = text_topology.new({ "x", "abc" }, "utf-8") + local till_x = motion_plan.build( + target_plan.build(target("x"), matching_policy()), + "T" + ) + local cross_line = engine:calculate( + cross_line_view, + domain.Position.new(2, 2), + till_x, + 1, + true + ) + same(domain.Position.new(2, 1), cross_line.endpoint) + truthy(cross_line_view:is_valid_cursor_position(cross_line.endpoint)) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3