diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:25:43 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:25:43 +0200 |
| commit | ab20c92fb4025d447b41de5529c2380a668f4958 (patch) | |
| tree | 221ad72ff48f1697bfbe45e8eaa01dbffaab85a5 /lua/clever_f/destination_engine.lua | |
| parent | f04282c17fa96e88e939e17d823489dbf10594e7 (diff) | |
Accept initial stationary TILL destinations
Diffstat (limited to 'lua/clever_f/destination_engine.lua')
| -rw-r--r-- | lua/clever_f/destination_engine.lua | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/lua/clever_f/destination_engine.lua b/lua/clever_f/destination_engine.lua index 0ae2314..e3a7fc1 100644 --- a/lua/clever_f/destination_engine.lua +++ b/lua/clever_f/destination_engine.lua @@ -100,14 +100,22 @@ local function strict_destination(descriptor, destination, origin) return comparison < 0 end -local function acceptable_destination(request, destination, origin) - if request.plan.descriptor.family == domain.Family.FIND then - return strict_destination(request.plan.descriptor, destination, origin) +local function acceptable_destination( + request, + destination, + origin, + allow_till_equality +) + local descriptor = request.plan.descriptor + if strict_destination(descriptor, destination, origin) then + return true end - return true + return descriptor.family == domain.Family.TILL + and allow_till_equality + and domain.Position.equal(destination, origin) end -local function next_destination(request, origin) +local function next_destination(request, origin, allow_till_equality) local candidates = candidate_starts(request, origin) while true do @@ -122,7 +130,12 @@ local function next_destination(request, origin) ) then local destination = target_destination(request, target_position) if destination ~= nil - and acceptable_destination(request, destination, origin) + and acceptable_destination( + request, + destination, + origin, + allow_till_equality + ) then return destination end @@ -132,7 +145,11 @@ 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) + local destination = next_destination( + request, + request.origin, + request.first_move + ) if destination == nil then return domain.SearchOutcome.boundary_before_any(request.origin) end |
