summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:22:02 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:22:02 +0200
commit80496b38064f1abde2b5870955bd73b7d3a3d794 (patch)
treed2f32e6d99501b1731fedf326c8ca53c7d1d3b1f /tests/run.lua
parent1a9f90afcc6e5e00a94dd188a5361a894d06e257 (diff)
Adjust exclusive FIND destinations
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua27
1 files changed, 27 insertions, 0 deletions
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