summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:42:30 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:42:30 +0200
commit01caae6671f456d898f20d1ea29c3315c93f01f2 (patch)
tree7507b3cbb12702beaf6eec00fc97ce6d1c7484ee /tests
parente504a829432d9a80357f6c6416b4510070919a1c (diff)
Count exact preview characters
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 7c4c52d..7ec0baf 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -4625,6 +4625,30 @@ test("Direct preview count normalizes absent and entered values", function()
end, "positive integer")
end)
+test("Default direct previews count each exact character", function()
+ local view = text_topology.new({ "pOge huga Hiyo pOyo" }, "utf-8")
+ local planner = direct_preview_planner.new()
+ local origin = domain.Position.new(1, 1)
+
+ local function columns(positions)
+ local result = {}
+ for index, position in ipairs(positions) do
+ result[index] = position.byte_column
+ end
+ return result
+ end
+
+ list_same(
+ { 2, 3, 4, 5, 6, 7, 9, 11, 12, 13, 14, 16 },
+ columns(planner:plan(view, origin, "f", 1))
+ )
+ list_same(
+ { 8, 10, 17, 18, 19 },
+ columns(planner:plan(view, origin, "f", 2))
+ )
+ list_same({ 15 }, columns(planner:plan(view, origin, "f", 3)))
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then