summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:42:03 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:42:03 +0200
commitc55cd67ff7f38e4f68a955673a69aeb7eae56f19 (patch)
tree94899a19e9c734eed65ca31d2f0c4a40c1338c51
parent275729dbfdf809dc7972d87cba0c5e589a39a5dc (diff)
Gate repeated TILL migration
-rw-r--r--lua/clever_f/feedback_service.lua10
-rw-r--r--tests/run.lua19
2 files changed, 29 insertions, 0 deletions
diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua
index 9d7ef28..eab03e6 100644
--- a/lua/clever_f/feedback_service.lua
+++ b/lua/clever_f/feedback_service.lua
@@ -607,6 +607,16 @@ function FeedbackService:persistent_requests()
return result
end
+function M.repeated_till_migration_candidate(request)
+ if type(request) ~= "table" then
+ fail("command feedback migration request must be a table", 2)
+ end
+ local plan = request.resolved_motion_plan or request.plan
+ return domain.ResolvedMotionPlan.is(plan)
+ and plan.descriptor.family == domain.Family.TILL
+ and request.first_move == false
+end
+
function M.command_migration_reason(request)
if type(request) ~= "table" then
fail("command feedback migration request must be a table", 2)
diff --git a/tests/run.lua b/tests/run.lua
index 0663c2e..792f15b 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -6436,6 +6436,25 @@ test("Cross-line command movement rebuilds feedback at destination", function()
same(2, state.target_overlays[1].anchor_line)
end)
+test("TILL migration requires a repeated move", function()
+ local shared_target = target_plan.build(target("a"), matching_policy())
+ local till = motion_plan.build(shared_target, "t")
+ local find = motion_plan.build(shared_target, "f")
+
+ falsy(feedback_service.repeated_till_migration_candidate({
+ resolved_motion_plan = till,
+ first_move = true,
+ }))
+ truthy(feedback_service.repeated_till_migration_candidate({
+ resolved_motion_plan = till,
+ first_move = false,
+ }))
+ falsy(feedback_service.repeated_till_migration_candidate({
+ resolved_motion_plan = find,
+ first_move = false,
+ }))
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then