summaryrefslogtreecommitdiff
path: root/lua/clever_f/motion_executor.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:49:27 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:49:27 +0200
commit26e79b1a99624c43c4149bd09b047af19c615a1c (patch)
tree007f9a1ab421bc97ee34d9c0cbdee2e090c34253 /lua/clever_f/motion_executor.lua
parent33e93f67e78d3a502401442f80ff2572ed35d5dd (diff)
Classify stationary TILL moves
Diffstat (limited to 'lua/clever_f/motion_executor.lua')
-rw-r--r--lua/clever_f/motion_executor.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/lua/clever_f/motion_executor.lua b/lua/clever_f/motion_executor.lua
index 9718640..b66f0b7 100644
--- a/lua/clever_f/motion_executor.lua
+++ b/lua/clever_f/motion_executor.lua
@@ -31,6 +31,18 @@ function M.moved_forward(origin, destination)
return domain.Position.compare(destination, origin) > 0
end
+function M.command_moved_forward(descriptor, origin, destination)
+ descriptor = domain.Descriptor.from_string(descriptor)
+ origin = domain.Position.coerce(origin)
+ destination = domain.Position.coerce(destination)
+ if descriptor.family == domain.Family.TILL
+ and domain.Position.stationary(origin, destination)
+ then
+ return false
+ end
+ return M.moved_forward(origin, destination)
+end
+
local function copy_options(options)
local result = {}
for key, value in pairs(options or {}) do
@@ -147,7 +159,11 @@ function MotionExecutor:_execute_command(request)
if not outcome.complete then
return domain.ActionOutcome.from_search(outcome, request.plan.descriptor)
end
- request.moved_forward = M.moved_forward(origin, outcome.endpoint)
+ request.moved_forward = M.command_moved_forward(
+ request.plan.descriptor,
+ origin,
+ outcome.endpoint
+ )
return domain.ActionOutcome.from_search(outcome, request.plan.descriptor)
end