From ed872974d799312c7114a63474c6bc7bc2179e2c Mon Sep 17 00:00:00 2001 From: t Date: Wed, 26 Aug 2026 09:16:23 -0600 Subject: Use Panto terminal width helpers for progress rendering --- spec/fake_ext.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'spec/fake_ext.lua') diff --git a/spec/fake_ext.lua b/spec/fake_ext.lua index 88c4b56..fce012b 100644 --- a/spec/fake_ext.lua +++ b/spec/fake_ext.lua @@ -50,6 +50,27 @@ local M = {} +-- Enough of panto.text for progress-renderer specs; dedicated host tests cover +-- the real terminal-width implementation. +M.text = { + truncate = function(value, width) + return tostring(value or ""):sub(1, math.max(0, width)) + end, + wrap = function(value, width) + width = math.max(1, width) + value = tostring(value or "") + if value == "" then return { "" } end + local rows = {} + for line in (value .. "\n"):gmatch("(.-)\n") do + repeat + rows[#rows + 1] = line:sub(1, width) + line = line:sub(width + 1) + until line == "" + end + return rows + end, +} + -- --------------------------------------------------------------------------- -- luv stand-in, installed once when this module loads -- --------------------------------------------------------------------------- @@ -806,6 +827,7 @@ function M.install(opts) handle.ext = ext package.loaded.panto = { ext = ext, + text = M.text, agent = new_agent, file_system_jsonl_store = function(arg) return new_store("fs", arg) -- cgit v1.3