summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to '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