summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:38:27 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 12:38:27 +0200
commit107d14db6ac0731215c3e34eebe1c06b4e8fdb6a (patch)
tree6d064c48f19dcffa2ef4bf99db64d7fbd78ba502 /tests
parent0df9949734b3e39893c75839ba84c4b858acb274 (diff)
Finalize divergent cursor movement
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 baa8f29..2fe0460 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -6193,6 +6193,40 @@ test("Matching CursorMoved preserves the active sequence", function()
same(1, #state.finalizers)
end)
+test("Different CursorMoved applies full finalization", function()
+ local state, transitions = fresh_sequence_state()
+ local host = MemoryHost.new({
+ buffer_lines = { "aba" },
+ cursor = { line = 1, byte_column = 2 },
+ })
+ 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"))
+ transitions:CommitCommandSuccess("n", domain.Position.new(1, 3), true)
+ transitions:BeginAcquisition("v", "t")
+ transitions:CommitVisualSuccess("v", domain.Position.new(1, 2))
+ feedback:request_persistent({
+ context = "n",
+ anchor = domain.Position.new(1, 1),
+ target_plan = shared_target,
+ motion_plan = movement,
+ window = "window-1",
+ })
+
+ host:deliver_event("CursorMoved", {})
+
+ same(nil, state:get_previous_landing("n"))
+ same(nil, state:get_previous_landing("v"))
+ falsy(state.moved_forward)
+ same(0, #state.target_overlays)
+ same(0, #state.finalizers)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then