fix: properly restore color
This commit is contained in:
@@ -247,6 +247,9 @@ function drawLogs(x0, y0, x1, y1)
|
|||||||
local w = x1 - x0
|
local w = x1 - x0
|
||||||
local h = y1 - y0
|
local h = y1 - y0
|
||||||
|
|
||||||
|
local prevColourBg = term.getBackgroundColour()
|
||||||
|
local prevColourFg = term.getTextColour()
|
||||||
|
|
||||||
local drawnLines = 0
|
local drawnLines = 0
|
||||||
for i = #log.buffer - logOffset, 1, -1 do
|
for i = #log.buffer - logOffset, 1, -1 do
|
||||||
if drawnLines > h then break end
|
if drawnLines > h then break end
|
||||||
@@ -256,9 +259,6 @@ function drawLogs(x0, y0, x1, y1)
|
|||||||
|
|
||||||
term.setCursorPos(1, y1 - drawnLines)
|
term.setCursorPos(1, y1 - drawnLines)
|
||||||
|
|
||||||
local prevColourBg = term.getBackgroundColour()
|
|
||||||
local prevColourFg = term.getTextColour()
|
|
||||||
|
|
||||||
term.setBackgroundColor(format["BG"])
|
term.setBackgroundColor(format["BG"])
|
||||||
term.setTextColor(format["FG"])
|
term.setTextColor(format["FG"])
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ function drawLogs(x0, y0, x1, y1)
|
|||||||
term.setCursorPos(1, y1 - drawnLines)
|
term.setCursorPos(1, y1 - drawnLines)
|
||||||
|
|
||||||
if isFirstLine then
|
if isFirstLine then
|
||||||
term.setCursorPos(prefix:len(), y1 - drawnLines)
|
term.setCursorPos(prefix:len() + 1, y1 - drawnLines)
|
||||||
isFirstLine = false
|
isFirstLine = false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -290,18 +290,15 @@ function drawLogs(x0, y0, x1, y1)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if format["AffectContent"] then
|
if format["AffectContent"] then
|
||||||
-- term.write((" %s\n"):format(entry.message))
|
|
||||||
term.setBackgroundColor(prevColourBg)
|
term.setBackgroundColor(prevColourBg)
|
||||||
term.setTextColor(prevColourFg)
|
term.setTextColor(prevColourFg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- else
|
|
||||||
-- term.write((" %s\n"):format(entry.message))
|
|
||||||
-- end
|
|
||||||
|
|
||||||
drawnLines = drawnLines + 1
|
drawnLines = drawnLines + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
term.setBackgroundColor(prevColourBg)
|
||||||
|
term.setTextColor(prevColourFg)
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawStatusBar(y)
|
function drawStatusBar(y)
|
||||||
|
|||||||
Reference in New Issue
Block a user