diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:27:53 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:27:53 +0200 |
| commit | fafe4dfe8ae5ef86ead6667f6d821c32cb5e13ed (patch) | |
| tree | 351a789a76e72088a1799f9861b810db429c1b29 /lua/clever_f | |
| parent | 1d7cf6fe16c4b1e9a2cfc71b9feb098118cf7ca8 (diff) | |
Stop counts at search boundaries
Diffstat (limited to 'lua/clever_f')
| -rw-r--r-- | lua/clever_f/destination_engine.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lua/clever_f/destination_engine.lua b/lua/clever_f/destination_engine.lua index 8a07328..e039851 100644 --- a/lua/clever_f/destination_engine.lua +++ b/lua/clever_f/destination_engine.lua @@ -151,6 +151,7 @@ function DestinationEngine:calculate(view, origin, plan, count, first_move) local request = calculation_inputs(view, origin, plan, count, first_move) local current_origin = request.origin local successful_steps = 0 + local boundary_reached = false while successful_steps < request.count.value do local destination = next_destination( @@ -159,13 +160,17 @@ function DestinationEngine:calculate(view, origin, plan, count, first_move) till_equality_allowed(request, successful_steps) ) if destination == nil then - return domain.SearchOutcome.boundary_before_any(request.origin) + boundary_reached = true + break end current_origin = destination successful_steps = successful_steps + 1 end - return domain.SearchOutcome.complete(current_origin, successful_steps) + if not boundary_reached then + return domain.SearchOutcome.complete(current_origin, successful_steps) + end + return domain.SearchOutcome.boundary_before_any(request.origin) end function M.new() |
