summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:52:02 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 10:52:02 +0200
commit7c145a7e7369a2f02f32383603186ca1471794c0 (patch)
tree0f4b5f252178034457da336e06514e1f735a7867 /tests/run.lua
parentfa79c6d1c815fb87086b0cdd4eb48d55fe865134 (diff)
Preserve Visual direction and anchor
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua45
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