From 1d7cf6fe16c4b1e9a2cfc71b9feb098118cf7ca8 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 10:27:07 +0200 Subject: Advance sequential count origins --- lua/clever_f/destination_engine.lua | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'lua/clever_f') diff --git a/lua/clever_f/destination_engine.lua b/lua/clever_f/destination_engine.lua index 53b26fe..8a07328 100644 --- a/lua/clever_f/destination_engine.lua +++ b/lua/clever_f/destination_engine.lua @@ -149,15 +149,23 @@ end function DestinationEngine:calculate(view, origin, plan, count, first_move) local request = calculation_inputs(view, origin, plan, count, first_move) - local destination = next_destination( - request, - request.origin, - till_equality_allowed(request, 0) - ) - if destination == nil then - return domain.SearchOutcome.boundary_before_any(request.origin) + local current_origin = request.origin + local successful_steps = 0 + + while successful_steps < request.count.value do + local destination = next_destination( + request, + current_origin, + till_equality_allowed(request, successful_steps) + ) + if destination == nil then + return domain.SearchOutcome.boundary_before_any(request.origin) + end + current_origin = destination + successful_steps = successful_steps + 1 end - return domain.SearchOutcome.complete(destination, 1) + + return domain.SearchOutcome.complete(current_origin, successful_steps) end function M.new() -- cgit v1.2.3