fix error text peeking through the scroll text

lazyvim also changed the indentation of everything for some reason
i don't know what's the name for "scroll text"
This commit is contained in:
Ponali
2025-09-24 07:02:31 +02:00
parent 99725b43ba
commit 732f747347
+67 -65
View File
@@ -2,43 +2,43 @@ local gpu = component.proxy(component.list("gpu")())
local resX, resY = gpu.getResolution() local resX, resY = gpu.getResolution()
local function loadfile(file) local function loadfile(file)
checkArg(1, file, "string") checkArg(1, file, "string")
local handle = component.invoke(computer.getBootAddress(), "open", file, "r") local handle = component.invoke(computer.getBootAddress(), "open", file, "r")
local data = "" local data = ""
repeat repeat
local tmpdata = component.invoke(computer.getBootAddress(), "read", handle, math.huge or math.maxinteger) local tmpdata = component.invoke(computer.getBootAddress(), "read", handle, math.huge or math.maxinteger)
data = data .. (tmpdata or "") data = data .. (tmpdata or "")
until not tmpdata until not tmpdata
component.invoke(computer.getBootAddress(), "close", handle) component.invoke(computer.getBootAddress(), "close", handle)
return assert(load(data, "=" .. file)) return assert(load(data, "=" .. file))
end end
local function handleError(errorMessage) local function handleError(errorMessage)
return(errorMessage.."\n \n"..debug.traceback()) return (errorMessage .. "\n \n" .. debug.traceback())
end end
function loadBoot() function loadBoot()
local foundArchitecture = false local foundArchitecture = false
for _, arch in pairs(computer.getArchitectures()) do for _, arch in pairs(computer.getArchitectures()) do
if arch == "Lua 5.3" then if arch == "Lua 5.3" then
foundArchitecture = true foundArchitecture = true
break break
end end
end end
if foundArchitecture then if foundArchitecture then
local _, errorMesage = computer.setArchitecture("Lua 5.3") local _, errorMesage = computer.setArchitecture("Lua 5.3")
if errorMessage then if errorMessage then
error(errorMessage) error(errorMessage)
end end
else else
gpu.set(1, 1, "Required architecture (Lua 5.3) is not supported.") gpu.set(1, 1, "Required architecture (Lua 5.3) is not supported.")
gpu.set(1, 2, "Halting.") gpu.set(1, 2, "Halting.")
while true do while true do
computer.pullSignal() computer.pullSignal()
end end
end end
loadfile("/halyde/kernel/boot.lua")(loadfile) loadfile("/halyde/kernel/boot.lua")(loadfile)
end end
gpu.setBackground(0x000000) gpu.setBackground(0x000000)
@@ -50,39 +50,41 @@ local beep = computer.beep
local result, reason = xpcall(loadBoot, handleError) local result, reason = xpcall(loadBoot, handleError)
if not result then if not result then
local bgColor local bgColor
if gpu.getDepth() == 1 then if gpu.getDepth() == 1 then
bgColor = 0x000000 bgColor = 0x000000
else else
bgColor = 0x000080 bgColor = 0x000080
end end
gpu.setBackground(bgColor) gpu.setBackground(bgColor)
gpu.fill(1, 1, resX, resY, " ") gpu.fill(1, 1, resX, resY, " ")
local function render() local function render()
gpu.setForeground(0xFFFFFF) gpu.setForeground(0xFFFFFF)
local i = 2 local i = 2
reason = "A fatal error has occurred.\nHalyde cannot continue.\n \n" .. tostring(reason or "unknown error"):gsub("\t", " ") reason = "A fatal error has occurred.\nHalyde cannot continue.\n \n"
for line in string.gmatch(reason, "([^\n]*)\n?") do .. tostring(reason or "unknown error"):gsub("\t", " ")
gpu.set(2, i, line) for line in string.gmatch(reason, "([^\n]*)\n?") do
i = i + 1 gpu.set(2, i, line)
end i = i + 1
gpu.set(1, resY - 1, string.rep("", resX)) end
gpu.setForeground(bgColor) gpu.fill(1, resY - 1, resX, 1, "")
gpu.setBackground(0xFFFFFF) gpu.fill(1, resY, resX, 1, " ")
gpu.set(2, resY, "🠅 🠄 🠇 🠆") gpu.setForeground(bgColor)
gpu.setForeground(0xFFFFFF) gpu.setBackground(0xFFFFFF)
gpu.setBackground(bgColor) gpu.set(2, resY, "🠅 🠄 🠇 🠆")
gpu.set(4, resY, " / ") gpu.setForeground(0xFFFFFF)
gpu.set(9, resY, " / ") gpu.setBackground(bgColor)
gpu.set(14, resY, " / ") gpu.set(4, resY, " / ")
gpu.set(20, resY, "Scroll" .. string.rep(" ", resX - 21)) gpu.set(9, resY, " / ")
end gpu.set(14, resY, " / ")
render() gpu.set(19, resY, " Scroll" .. string.rep(" ", resX - 21))
beep(440, 0.2) end
beep(465, 0.2) render()
beep(440, 0.2) beep(440, 0.2)
beep(370, 0.5) beep(465, 0.2)
while true do -- TODO: Make this scrollable beep(440, 0.2)
pullSignal() beep(370, 0.5)
end while true do -- TODO: Make this scrollable
pullSignal()
end
end end