fix: draw from bottom to start
This commit is contained in:
@@ -182,8 +182,20 @@ function handleMessages(side, channel, replyChannel, message, dist)
|
||||
end
|
||||
registerEventListener("modem_message", handleMessages)
|
||||
|
||||
local logOffset = 0
|
||||
|
||||
-- to-do: add key handlers
|
||||
function handleKey(key, isHeld)
|
||||
log.info("key pressed (%d)", key)
|
||||
|
||||
if key == 265 then
|
||||
logOffset = logOffset - 1
|
||||
elseif key == 264 then
|
||||
logOffset = logOffset + 1
|
||||
end
|
||||
|
||||
if logOffset < 0 then logOffset = 0 end
|
||||
if logOffset >= #log.buffer then logOffset = #log.buffer - 1 end
|
||||
end
|
||||
registerEventListener("key", handleKey)
|
||||
|
||||
@@ -232,7 +244,7 @@ function updateScreen()
|
||||
local entry = log.buffer[i]
|
||||
local format = logTypes[entry.type]
|
||||
|
||||
term.setCursorPos(0, startY - 1 + i)
|
||||
term.setCursorPos(0, endY - i)
|
||||
|
||||
local prevColourBg = term.getBackgroundColour()
|
||||
local prevColourFg = term.getTextColour()
|
||||
@@ -273,6 +285,6 @@ end
|
||||
]]
|
||||
sendToAll("SCAN", { ["hostChannel"] = HOST_CHANNEL })
|
||||
while true do
|
||||
pollEvents()
|
||||
updateScreen()
|
||||
pollEvents()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user