summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:41:35 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:41:35 +0200
commit275729dbfdf809dc7972d87cba0c5e589a39a5dc (patch)
tree2281ec61f177ae664bc1da209419c431d7c292db /tests/run.lua
parent70bc720156f8ff315fcf54f478becfdf098f3994 (diff)
Rebuild cross-line feedback
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index e73dda7..0663c2e 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -6399,6 +6399,43 @@ test("Command feedback migration compares origin and destination lines", functio
)
end)
+test("Cross-line command movement rebuilds feedback at destination", function()
+ local state, transitions = fresh_sequence_state()
+ local host = MemoryHost.new({ buffer_lines = { "a", "xax" } })
+ local feedback = feedback_service.new({
+ host = host,
+ transitions = transitions,
+ })
+ local shared_target = target_plan.build(target("a"), matching_policy())
+ local movement = motion_plan.build(shared_target, "f")
+ local first = feedback:request_persistent({
+ context = "n",
+ anchor = domain.Position.new(1, 1),
+ target_plan = shared_target,
+ motion_plan = movement,
+ window = "window-1",
+ })
+
+ local migration = feedback:migrate_command({
+ context = domain.ModeContext.from_full_mode("n"),
+ origin = domain.Position.new(1, 1),
+ destination = domain.Position.new(2, 2),
+ outcome = domain.SearchOutcome.complete(domain.Position.new(2, 2), 1),
+ resolved_motion_plan = movement,
+ first_move = true,
+ moved_forward = true,
+ })
+
+ truthy(migration.migrated)
+ same(feedback_service.MigrationReason.LINE_CHANGE, migration.reason)
+ same(2, migration.overlay.anchor.line)
+ same(2, migration.overlay.match_start_line)
+ same(nil, host:highlights()[first.identity])
+ truthy(host:highlights()[migration.overlay.identity] ~= nil)
+ same(1, #state.target_overlays)
+ same(2, state.target_overlays[1].anchor_line)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then