summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 13:47:20 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 13:47:20 +0200
commit7ec26094fee806bf53f3eb253b57f3a06025c70d (patch)
tree4e4fddcfb944988f87ee1b0a4fe49cdb14059a9a
parent63e3f4d19d70211a1e1b271d95219e222c1dd2ce (diff)
Build explicit motion plans
-rw-r--r--lua/clever_f/sequence_coordinator.lua29
-rw-r--r--tests/run.lua25
2 files changed, 52 insertions, 2 deletions
diff --git a/lua/clever_f/sequence_coordinator.lua b/lua/clever_f/sequence_coordinator.lua
index 7a23eab..4d64e51 100644
--- a/lua/clever_f/sequence_coordinator.lua
+++ b/lua/clever_f/sequence_coordinator.lua
@@ -500,11 +500,36 @@ function SequenceCoordinator:resolve_explicit(kind, resolver_method)
if type(resolver[resolver_method]) ~= "function" then
fail("RepeatResolver must build " .. kind .. " requests", 2)
end
- return {
+ local request = resolver[resolver_method](resolver, invocation.context)
+ local resolution = {
kind = kind,
invocation = invocation,
- request = resolver[resolver_method](resolver, invocation.context),
+ request = request,
}
+ if request.neutral then
+ return resolution
+ end
+ local target_plan, text_view, search_scope = self:build_live_target_plan(
+ request.target,
+ invocation
+ )
+ local motion_plan = self:build_movement_plan(
+ target_plan,
+ request.descriptor,
+ invocation,
+ search_scope
+ )
+ resolution.target = request.target
+ resolution.target_plan = target_plan
+ resolution.motion_plan = motion_plan
+ resolution.text_view = text_view
+ resolution.search_scope = search_scope
+ resolution.effective_descriptor = request.descriptor
+ resolution.first_move = coordinator_records[self].state:get_first_move(
+ invocation.context
+ ) == true
+ resolution.skip_destination = target_plan.kind == domain.TargetPlanKind.EMPTY
+ return resolution
end
function SequenceCoordinator:resolve_explicit_same()
diff --git a/tests/run.lua b/tests/run.lua
index c755c05..204a0f3 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -7768,6 +7768,31 @@ test("Explicit coordination keeps code-zero target fallback", function()
end
end)
+test("Explicit coordination builds target and resolved motion plans", function()
+ local _, transitions = fresh_sequence_state()
+ local stored_target = target("a")
+ transitions:BeginAcquisition("n", "t")
+ transitions:CommitAcquiredTarget("n", stored_target)
+ local host = MemoryHost.new({
+ buffer_lines = { "aA" },
+ configuration = {
+ ignore_case = true,
+ search_current_line_only = true,
+ },
+ })
+ local coordinator = sequence_coordinator.new({ host = host })
+
+ local resolution = coordinator:repeat_opposite_direction()
+
+ same(stored_target, resolution.target)
+ same(domain.CaseMode.INSENSITIVE, resolution.target_plan.case_mode)
+ same(resolution.target_plan, resolution.motion_plan.target_plan)
+ same(domain.Descriptor.TILL_BACKWARD, resolution.effective_descriptor)
+ same(resolution.effective_descriptor, resolution.motion_plan.descriptor)
+ same(domain.SearchScope.CURRENT_LINE, resolution.motion_plan.search_scope)
+ same(domain.EndpointPolicy.REGULAR, resolution.motion_plan.endpoint_policy)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then