diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:29:59 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:29:59 +0200 |
| commit | 2b62f5654d6b9d939266dda369c52ba0aaa59c07 (patch) | |
| tree | a8605574725c873ce70d396d34798f6fb7add8b4 /lua/clever_f/destination_engine.lua | |
| parent | 3521acb1ddeff755e4af9c385ec0b202fa3c3333 (diff) | |
Preserve origins before any match
Diffstat (limited to 'lua/clever_f/destination_engine.lua')
| -rw-r--r-- | lua/clever_f/destination_engine.lua | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lua/clever_f/destination_engine.lua b/lua/clever_f/destination_engine.lua index 027dd2a..53cb654 100644 --- a/lua/clever_f/destination_engine.lua +++ b/lua/clever_f/destination_engine.lua @@ -147,6 +147,16 @@ local function till_equality_allowed(request, successful_steps) return request.first_move and successful_steps == 0 end +local function boundary_outcome(request, endpoint, successful_steps) + if successful_steps > 0 then + return domain.SearchOutcome.boundary_after_partial( + endpoint, + successful_steps + ) + end + return domain.SearchOutcome.boundary_before_any(request.origin) +end + function DestinationEngine:calculate(view, origin, plan, count, first_move) local request = calculation_inputs(view, origin, plan, count, first_move) local current_origin = request.origin @@ -168,13 +178,7 @@ function DestinationEngine:calculate(view, origin, plan, count, first_move) if successful_steps == request.count.value then return domain.SearchOutcome.complete(current_origin, successful_steps) end - if successful_steps > 0 then - return domain.SearchOutcome.boundary_after_partial( - current_origin, - successful_steps - ) - end - return domain.SearchOutcome.boundary_before_any(request.origin) + return boundary_outcome(request, current_origin, successful_steps) end function M.new() |
