summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:37:56 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:37:56 +0200
commit0df9949734b3e39893c75839ba84c4b858acb274 (patch)
tree68d091618e4846f8c0056667504285d892b802a3 /tests
parentadfb712e10e834e19c1541d0657fe4af4489be61 (diff)
Preserve matching cursor sequence
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 902d846..baa8f29 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -6159,6 +6159,40 @@ test("CursorMoved compares the actual cursor with the last-input landing", funct
falsy(different.equal)
end)
+test("Matching CursorMoved preserves the active sequence", function()
+ local state, transitions = fresh_sequence_state()
+ local landing = domain.Position.new(1, 3)
+ local host = MemoryHost.new({
+ buffer_lines = { "aba" },
+ cursor = landing,
+ })
+ 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")
+ transitions:BeginAcquisition("n", "f")
+ transitions:CommitAcquiredTarget("n", target("a"))
+ feedback:request_persistent({
+ context = "n",
+ anchor = domain.Position.new(1, 1),
+ target_plan = shared_target,
+ motion_plan = movement,
+ window = "window-1",
+ })
+ transitions:CommitCommandSuccess("n", landing, true)
+ local before = state:snapshot()
+
+ host:deliver_event("CursorMoved", { cursor = landing })
+
+ same(before.previous_descriptor[domain.ModeContext.from_full_mode("n")],
+ state:get_previous_descriptor("n"))
+ same(landing, state:get_previous_landing("n"))
+ same(1, #state.target_overlays)
+ same(1, #state.finalizers)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then