fix: properly restore color

This commit is contained in:
2025-05-08 00:55:39 -03:00
parent f426fb4f3f
commit a00403549a
+7 -10
View File
@@ -247,6 +247,9 @@ function drawLogs(x0, y0, x1, y1)
local w = x1 - x0
local h = y1 - y0
local prevColourBg = term.getBackgroundColour()
local prevColourFg = term.getTextColour()
local drawnLines = 0
for i = #log.buffer - logOffset, 1, -1 do
if drawnLines > h then break end
@@ -256,9 +259,6 @@ function drawLogs(x0, y0, x1, y1)
term.setCursorPos(1, y1 - drawnLines)
local prevColourBg = term.getBackgroundColour()
local prevColourFg = term.getTextColour()
term.setBackgroundColor(format["BG"])
term.setTextColor(format["FG"])
@@ -280,7 +280,7 @@ function drawLogs(x0, y0, x1, y1)
term.setCursorPos(1, y1 - drawnLines)
if isFirstLine then
term.setCursorPos(prefix:len(), y1 - drawnLines)
term.setCursorPos(prefix:len() + 1, y1 - drawnLines)
isFirstLine = false
end
@@ -290,18 +290,15 @@ function drawLogs(x0, y0, x1, y1)
end
if format["AffectContent"] then
-- term.write((" %s\n"):format(entry.message))
term.setBackgroundColor(prevColourBg)
term.setTextColor(prevColourFg)
end
-- else
-- term.write((" %s\n"):format(entry.message))
-- end
drawnLines = drawnLines + 1
end
term.setBackgroundColor(prevColourBg)
term.setTextColor(prevColourFg)
end
function drawStatusBar(y)