fix textgpu somehow getting *really* long buffer lines, which broke things sometimes
This commit is contained in:
parent
f847f6a2ca
commit
c6a0ecd8a4
@ -78,7 +78,7 @@ local function set(x, y, text, f, b, safe, noref)
|
||||
write("\27[38;2;", r, ";", g, ";", _b, "m")
|
||||
end
|
||||
fbuffer[y] = fbuffer[y]:sub(1, x - 1) ..
|
||||
string.rep(string.char(f - 1), len) .. fbuffer[y]:sub(x + len)
|
||||
string.rep(string.char(f - 1), len) .. fbuffer[y]:sub(x + len)
|
||||
end
|
||||
if type(b) == "string" then
|
||||
bbuffer[y] = bbuffer[y]:sub(1, x - 1) ..
|
||||
@ -92,6 +92,10 @@ local function set(x, y, text, f, b, safe, noref)
|
||||
bbuffer[y] = bbuffer[y]:sub(1, x - 1) ..
|
||||
string.rep(string.char(b - 1), len) .. bbuffer[y]:sub(x + len)
|
||||
end
|
||||
-- clamp buffers
|
||||
tbuffer[y] = unsub(tbuffer[y], 1, w)
|
||||
fbuffer[y] = fbuffer[y]:sub(1, w)
|
||||
bbuffer[y] = bbuffer[y]:sub(1, w)
|
||||
if not noref then
|
||||
write("\27[", y, ";", x, "H", text)
|
||||
flush()
|
||||
@ -103,6 +107,7 @@ fullRefresh = function()
|
||||
local text = tbuffer[i]
|
||||
local fgt = fbuffer[i]
|
||||
local bgt = bbuffer[i]
|
||||
--native.log("UPDATE " .. i .. ": \"" .. text .. "\"")
|
||||
local pb, pf
|
||||
fgt = fgt:gsub("()(.)", function(n, fc)
|
||||
local bc, tc = bgt:sub(n,n), text:sub(n,n)
|
||||
@ -289,7 +294,8 @@ function textgpu.start()
|
||||
end
|
||||
for i=start, stop, step do
|
||||
local str, fstr, bstr = get(x, i, W, true)
|
||||
if str and fstr and bstr then
|
||||
--native.log("COPY " .. i .. " (" .. (str or "") .. ") to " .. (i + yd))
|
||||
if str then-- and fstr and bstr then
|
||||
set(x + xd, i + yd, str, fstr, bstr, true, true)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user