several more fixes #2

Open
Ocawesome101 wants to merge 19 commits from Ocawesome101/LuPPC:master into master
Showing only changes of commit c6a0ecd8a4 - Show all commits

View File

@ -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