summaryrefslogtreecommitdiff
path: root/spec/fake_ext.lua
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-08-26 09:16:23 -0600
committert <t@tjp.lol>2026-08-26 09:17:36 -0600
commited872974d799312c7114a63474c6bc7bc2179e2c (patch)
treec1af127d89f04e617eb8109a71805e91bfdc4521 /spec/fake_ext.lua
parenteeb3499f58fa909df7074e689c0f029c59ea767f (diff)
Use Panto terminal width helpers for progress rendering
Diffstat (limited to 'spec/fake_ext.lua')
-rw-r--r--spec/fake_ext.lua22
1 files changed, 22 insertions, 0 deletions
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)