summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:33:01 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:33:01 +0200
commit49ac634d8984e4cf64280eb28e2adade4925ed18 (patch)
treec3a9f96f35952e0ecdb05a4c52cdff7e685d646f
parentc6f2c9941742c84a43faee9e6426786bc1e8f13c (diff)
Anchor persistent match starts
-rw-r--r--lua/clever_f/feedback_service.lua1
-rw-r--r--tests/run.lua20
2 files changed, 21 insertions, 0 deletions
diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua
index 037c7fd..9c16cca 100644
--- a/lua/clever_f/feedback_service.lua
+++ b/lua/clever_f/feedback_service.lua
@@ -413,6 +413,7 @@ function FeedbackService:build_persistent(specification)
motion_plan = specification.motion_plan,
descriptor = descriptor,
endpoint_policy = endpoint_policy,
+ match_start_line = anchor.line,
positions = M.persistent_match_positions(
view,
anchor.line,
diff --git a/tests/run.lua b/tests/run.lua
index b044379..444a310 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -5933,6 +5933,26 @@ test("Persistent positions apply target predicates and endpoint transforms", fun
)
end)
+test("Persistent match starts stay on the anchor line", function()
+ fresh_sequence_state()
+ local host = MemoryHost.new({ buffer_lines = { "axa", "aya", "aza" } })
+ local feedback = feedback_service.new(host)
+ local shared_target = target_plan.build(target("a"), matching_policy())
+ local movement = motion_plan.build(shared_target, "f")
+ local persistent = feedback:build_persistent({
+ context = "n",
+ anchor = domain.Position.new(2, 2),
+ target_plan = shared_target,
+ motion_plan = movement,
+ window = "window-1",
+ })
+
+ same(2, persistent.match_start_line)
+ same(2, #persistent.positions)
+ same(domain.Position.new(2, 1), persistent.positions[1])
+ same(domain.Position.new(2, 3), persistent.positions[2])
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then