From ec1b1cccdae8ec536fdc99cc3b0f3fe0593c8ea4 Mon Sep 17 00:00:00 2001 From: Jackson Moore Date: Fri, 4 Sep 2026 11:43:10 +0200 Subject: Count folded preview classes --- tests/run.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/run.lua') diff --git a/tests/run.lua b/tests/run.lua index 7ec0baf..3c2a077 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -4649,6 +4649,33 @@ test("Default direct previews count each exact character", function() list_same({ 15 }, columns(planner:plan(view, origin, "f", 3))) end) +test("Ignore-case previews count editor-folded character classes", function() + local folded = {} + local planner = direct_preview_planner.new({ + lowercase = function(character) + folded[#folded + 1] = character + return string.lower(character) + end, + }) + local view = text_topology.new({ "xAaBbC" }, "utf-8") + local origin = domain.Position.new(1, 1) + + local positions = planner:plan(view, origin, "f", 2, { + ignore_case = true, + smart_case = false, + }) + same(2, #positions) + same(domain.Position.new(1, 3), positions[1]) + same(domain.Position.new(1, 5), positions[2]) + list_same({ "A", "a", "B", "b", "C" }, folded) + + local exact = planner:plan(view, origin, "f", 2, { + ignore_case = false, + smart_case = false, + }) + same(0, #exact) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then -- cgit v1.2.3