summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:47:32 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:47:32 +0200
commit36fa529fae92038daaddc7c88ec824cc71c1ffef (patch)
treef3d9288e026b6d1f5c59821c3451d4c15a1dd4fe /tests
parent6c3009c5041a2e661504825f68b0a3675562a647 (diff)
Restore feedback before primary movement
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index d66e2c5..2d343b6 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -6791,6 +6791,50 @@ test("Primary restoration combines action target with stored motion policy", fun
)
end)
+test("Primary repetition restores feedback before movement", function()
+ local state, transitions = fresh_sequence_state()
+ local host = MemoryHost.new({
+ buffer_lines = { "aba" },
+ cursor = { line = 1, byte_column = 1 },
+ configuration = { mark_char = true },
+ emit_movement_events = false,
+ })
+ local feedback = feedback_service.new({
+ host = host,
+ transitions = transitions,
+ })
+ local action_target = target_plan.build(target("a"), matching_policy())
+ local action_motion = motion_plan.build(action_target, "f")
+ host:clear_operations()
+
+ local restored = feedback:restore_primary({
+ context = "n",
+ anchor = domain.Position.new(1, 1),
+ target_plan = action_target,
+ motion_plan = action_motion,
+ stored_descriptor = "f",
+ endpoint_policy = domain.EndpointPolicy.REGULAR,
+ window = "window-1",
+ })
+ host:apply_cursor(domain.Position.new(1, 3), {
+ descriptor = domain.Descriptor.FIND_FORWARD,
+ origin = domain.Position.new(1, 1),
+ })
+
+ truthy(restored ~= nil)
+ same(restored.identity, state.target_overlays[1].identity)
+ local create_index
+ local movement_index
+ for index, operation in ipairs(host:operations()) do
+ if operation.operation == "create_highlight" then
+ create_index = index
+ elseif operation.operation == "apply_cursor" then
+ movement_index = index
+ end
+ end
+ truthy(create_index < movement_index)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then