Fixed textgpu.copy
This commit is contained in:
parent
e1e21a193b
commit
e3f753f4df
@ -125,4 +125,8 @@ function api.slot() --legacy
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function api.type(address)
|
||||||
|
return components[address].type
|
||||||
|
end
|
||||||
|
|
||||||
return component
|
return component
|
||||||
|
@ -159,32 +159,36 @@ function textgpu.start()
|
|||||||
local write = false
|
local write = false
|
||||||
for j=1, w do
|
for j=1, w do
|
||||||
if btbuf[i]:sub(j,j) ~= bg then
|
if btbuf[i]:sub(j,j) ~= bg then
|
||||||
bg = btbuf[i]:sub(j,j)
|
|
||||||
io.write("\x1b[4" .. bg .. "m")
|
|
||||||
write = true
|
write = true
|
||||||
end
|
end
|
||||||
if ftbuf[i]:sub(j,j) ~= fg then
|
if ftbuf[i]:sub(j,j) ~= fg then
|
||||||
fg = ftbuf[i]:sub(j,j)
|
|
||||||
io.write("\x1b[3" .. fg .. "m")
|
|
||||||
write = true
|
write = true
|
||||||
end
|
end
|
||||||
if not line then linex = j end
|
if not line then linex = j end
|
||||||
line = (line or "") .. ttbuf[i]:sub(j,j)
|
line = (line or "")
|
||||||
if write then
|
if write then
|
||||||
local wx = (tx + linex)|0
|
local wx = (tx + linex)|0
|
||||||
local wy = (ty + y + i - 1)|0
|
local wy = (ty + y + i - 1)|0
|
||||||
|
io.write("\x1b[4" .. bg .. "m")
|
||||||
|
io.write("\x1b[3" .. fg .. "m")
|
||||||
io.write("\x1b[" .. wy .. ";" .. wx .. "H" .. line)
|
io.write("\x1b[" .. wy .. ";" .. wx .. "H" .. line)
|
||||||
tbuffer[wy] = insertString(tbuffer[wy], line, wx)
|
tbuffer[wy] = insertString(tbuffer[wy], line, wx)
|
||||||
bbuffer[wy] = insertString(bbuffer[wy], bg:rep(utf8.len(line)), wx)
|
bbuffer[wy] = insertString(bbuffer[wy], bg:rep(utf8.len(line)), wx)
|
||||||
fbuffer[wy] = insertString(fbuffer[wy], fg:rep(utf8.len(line)), wx)
|
fbuffer[wy] = insertString(fbuffer[wy], fg:rep(utf8.len(line)), wx)
|
||||||
|
bg = btbuf[i]:sub(j,j)
|
||||||
|
fg = ftbuf[i]:sub(j,j)
|
||||||
line = nil
|
line = nil
|
||||||
linex = nil
|
linex = nil
|
||||||
write = false
|
write = false
|
||||||
end
|
end
|
||||||
|
if not line then linex = j end
|
||||||
|
line = (line or "") .. ttbuf[i]:sub(j,j)
|
||||||
end
|
end
|
||||||
if line then
|
if line then
|
||||||
local wx = (tx + linex)|0
|
local wx = (tx + linex)|0
|
||||||
local wy = (ty + y + i - 1)|0
|
local wy = (ty + y + i - 1)|0
|
||||||
|
io.write("\x1b[4" .. bg .. "m")
|
||||||
|
io.write("\x1b[3" .. fg .. "m")
|
||||||
io.write("\x1b[" .. wy .. ";" .. wx .. "H" .. line)
|
io.write("\x1b[" .. wy .. ";" .. wx .. "H" .. line)
|
||||||
tbuffer[wy] = insertString(tbuffer[wy], line, wx)
|
tbuffer[wy] = insertString(tbuffer[wy], line, wx)
|
||||||
bbuffer[wy] = insertString(bbuffer[wy], bg:rep(utf8.len(line)), wx)
|
bbuffer[wy] = insertString(bbuffer[wy], bg:rep(utf8.len(line)), wx)
|
||||||
@ -220,6 +224,7 @@ function textgpu.start()
|
|||||||
|
|
||||||
modules.component.api.register(nil, "gpu", gpu)
|
modules.component.api.register(nil, "gpu", gpu)
|
||||||
modules.component.api.register(nil, "screen", {getKeyboards = function() return {"TODO:SetThisUuid"} end}) --verry dummy screen, TODO: make it better, kbd uuid also in epoll.c
|
modules.component.api.register(nil, "screen", {getKeyboards = function() return {"TODO:SetThisUuid"} end}) --verry dummy screen, TODO: make it better, kbd uuid also in epoll.c
|
||||||
|
modules.component.api.register("TODO:SetThisUuid", "keyboard", {})
|
||||||
|
|
||||||
deadhooks[#deadhooks + 1] = function()
|
deadhooks[#deadhooks + 1] = function()
|
||||||
io.write("\x1b[?25h") --Enable cursor on quit
|
io.write("\x1b[?25h") --Enable cursor on quit
|
||||||
|
Loading…
Reference in New Issue
Block a user