From 7d08a49b62eed6c4afcd19897670fb10930faa46 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:05:52 +0200 Subject: Report missing previous input --- tests/run.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') diff --git a/tests/run.lua b/tests/run.lua index c968d87..69f5087 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5257,6 +5257,34 @@ test("Acquisition compares first codes with previous-input triggers", function() same(nil, acquisition_service.match_previous_input_trigger(122, { "xy" })) end) +test("Missing previous input preserves cursor and emits exact diagnostic", function() + fresh_sequence_state() + local origin = domain.Position.new(1, 2) + local host = MemoryHost.new({ + buffer_lines = { "abc" }, + cursor = origin, + configuration = { + mark_cursor = false, + hide_cursor_on_cmdline = false, + repeat_last_char_inputs = { "\r" }, + }, + input_packets = { { kind = "text", text = "\r" } }, + }) + local service = acquisition_service.new(host) + + local result = service:acquire("f", "n", origin, nil, nil) + truthy(result.missing_previous_input) + same(nil, result.target) + same(origin, host:read_cursor()) + same(1, #host:diagnostics()) + same("error", host:diagnostics()[1].level) + same("Previous input not found.", host:diagnostics()[1].text) + same( + acquisition_service.PREVIOUS_INPUT_NOT_FOUND, + host:diagnostics()[1].text + ) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3