diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:47:53 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:47:53 +0200 |
| commit | 3770a731f500e9253bbcf300c213276359a15686 (patch) | |
| tree | 07cbf7d10bfcdf0d146d2691343e0228ff7389e9 /tests | |
| parent | 768cb71841e9c2b0989d454e6d6804c0f2330eff (diff) | |
Save command origins
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index f10aa70..938d21a 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -3144,6 +3144,35 @@ test("Motion execution routes non-Visual contexts to the command path", function end end) +test("Command execution saves its origin before destination calculation", function() + local host = MemoryHost.new({ + buffer_lines = { "abc" }, + cursor = { line = 1, byte_column = 1 }, + }) + local view = text_topology.from_host(host) + local saved_origin + local engine = { + calculate = function(_, _, origin) + saved_origin = origin + host:set_cursor(domain.Position.new(1, 3)) + return domain.SearchOutcome.boundary_before_any(origin) + end, + } + local executor = motion_executor.new({ + host = host, + destination_engine = engine, + }) + local plan = motion_plan.build( + target_plan.build(target("z"), matching_policy()), + "f" + ) + + local outcome = executor:execute(view, "n", plan, 1, true) + same(domain.Position.new(1, 1), saved_origin) + same(domain.ActionKind.FAILED_SEARCH, outcome.kind) + same(domain.Position.new(1, 1), outcome.position) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
