From dbbbe30b637fccfacb15cd7317d4af87b658cfb5 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 12:02:34 +0200 Subject: Normalize ordinary acquisition input --- tests/run.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index 3f4c957..c279844 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -5153,6 +5153,34 @@ test("Acquisition discards the terminal artifact packet", function() same(2, reads) end) +test("Acquisition normalizes ordinary input to editor characters", function() + fresh_sequence_state() + local multibyte = "\227\129\130" + local host = MemoryHost.new({ + configuration = { mark_cursor = false }, + input_packets = { + { kind = "text", text = multibyte }, + }, + }) + local service = acquisition_service.new(host) + service:acquire("f", "n", domain.Position.new(1, 1), nil, nil) + + local target = service:last_temporary_scope().acquired_target + same(domain.TargetKind.CHARACTER, target.kind) + same(multibyte, target.value) + same(0x3042, target.first_code) + + local ascii = acquisition_service.normalize_ordinary_input( + domain.InputPacket.raw_bytes({ 65 }) + ) + same("A", ascii.value) + same(65, ascii.first_code) + local control = acquisition_service.normalize_ordinary_input( + domain.InputPacket.text(string.char(1)) + ) + same(1, control.first_code) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3