summaryrefslogtreecommitdiff
path: root/lua/clever_f/destination_engine.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:27:07 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:27:07 +0200
commit1d7cf6fe16c4b1e9a2cfc71b9feb098118cf7ca8 (patch)
treeb38d4322e8c037f763d0811784f37c28a19b651c /lua/clever_f/destination_engine.lua
parenta9ece4278ad0feb098db9027be1419121d61aca9 (diff)
Advance sequential count origins
Diffstat (limited to 'lua/clever_f/destination_engine.lua')
-rw-r--r--lua/clever_f/destination_engine.lua24
1 files changed, 16 insertions, 8 deletions
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()