diff options
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 743308d..2595224 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -3455,6 +3455,51 @@ test("Complete Visual execution commits landing and first-move state", function( same(target_value, state:get_previous_target("v")) end) +test("Visual execution preserves command direction and feedback anchor", function() + local state, transitions = fresh_sequence_state() + transitions:BeginAcquisition("n", "f") + transitions:CommitCommandSuccess("n", domain.Position.new(1, 1), true) + transitions:AddTargetOverlay("char-visual", "window-1", 1) + + local target_value = target("x") + transitions:BeginAcquisition("v", "f") + transitions:CommitAcquiredTarget("v", target_value) + local origin = domain.Position.new(1, 1) + local host = MemoryHost.new({ + buffer_lines = { "a", "x" }, + cursor = origin, + mode = "v", + selection = domain.Selection.active( + domain.SelectionKind.CHARACTER, + origin, + origin, + domain.SelectionOption.INCLUSIVE + ), + }) + local migration_count = 0 + local feedback = { + migrate_command = function() + migration_count = migration_count + 1 + end, + } + local plan = motion_plan.build( + target_plan.build(target_value, matching_policy()), + "f" + ) + motion_executor.new({ + host = host, + feedback_service = feedback, + }):execute(text_topology.from_host(host), "v", plan, 1, true) + + truthy(state.moved_forward) + truthy(state.moved_forward_initialized) + same(0, migration_count) + same(1, #state.target_overlays) + same("char-visual", state.target_overlays[1].identity) + same(1, state.target_overlays[1].anchor_line) + same(domain.Position.new(2, 1), state:get_previous_landing("v")) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
