summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:23:02 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:23:02 +0200
commit6449ffa5406ab4573f2148f23da06ed8d10d6ac4 (patch)
tree292c0a44fe94b8757d57d8c86bbee80e856aa7d3 /tests
parent80496b38064f1abde2b5870955bd73b7d3a3d794 (diff)
Adjust exclusive TILL destinations
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 4872cfd..f9fbeb8 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -2444,6 +2444,57 @@ test("Forward Visual-exclusive FIND uses target successors", function()
truthy(view:is_valid_cursor_position(adjusted.endpoint))
end)
+test("Forward Visual-exclusive TILL uses target positions", function()
+ local view = text_topology.new({ "abx", "x" }, "utf-8")
+ local engine = destination_engine.new()
+ local target_match = target_plan.build(target("x"), matching_policy())
+ local regular = motion_plan.build(
+ target_match,
+ "t",
+ "buffer",
+ domain.EndpointPolicy.REGULAR
+ )
+ local exclusive = motion_plan.build(
+ target_match,
+ "t",
+ "buffer",
+ domain.EndpointPolicy.VISUAL_EXCLUSIVE
+ )
+ local origin = domain.Position.new(1, 1)
+
+ same(
+ domain.Position.new(1, 2),
+ engine:calculate(view, origin, regular, 1, true).endpoint
+ )
+ same(
+ domain.Position.new(1, 3),
+ engine:calculate(view, origin, exclusive, 1, true).endpoint
+ )
+
+ local cross_line_view = text_topology.new({ "abc", "x" }, "utf-8")
+ local cross_line_origin = domain.Position.new(1, 1)
+ same(
+ domain.Position.new(1, 3),
+ engine:calculate(
+ cross_line_view,
+ cross_line_origin,
+ regular,
+ 1,
+ false
+ ).endpoint
+ )
+ same(
+ domain.Position.new(2, 1),
+ engine:calculate(
+ cross_line_view,
+ cross_line_origin,
+ exclusive,
+ 1,
+ false
+ ).endpoint
+ )
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then