From 2a19a70b2a9b9590f7e60932e3434abe46a20456 Mon Sep 17 00:00:00 2001 From: Ponali Date: Thu, 24 Jul 2025 11:04:23 +0200 Subject: [PATCH] v2.7.2 - Fixed the terminal library from assigning global temporary variables. --- argentum.cfg | 2 +- halyde/core/boot.lua | 2 +- halyde/core/termlib.lua | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/argentum.cfg b/argentum.cfg index b850c16..e0b7495 100644 --- a/argentum.cfg +++ b/argentum.cfg @@ -1,7 +1,7 @@ local agcfg = { ["halyde"] = { ["maindir"] = "", - ["version"] = "2.7.1", + ["version"] = "2.7.2", ["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.", ["directories"] = { "halyde/apps", diff --git a/halyde/core/boot.lua b/halyde/core/boot.lua index f162c9d..6f605c7 100644 --- a/halyde/core/boot.lua +++ b/halyde/core/boot.lua @@ -1,7 +1,7 @@ local loadfile = ... local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile) -_G._OSVERSION = "Halyde 2.7.1" +_G._OSVERSION = "Halyde 2.7.2" _G._OSLOGO = "" local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil repeat diff --git a/halyde/core/termlib.lua b/halyde/core/termlib.lua index 6078675..1d1e74b 100644 --- a/halyde/core/termlib.lua +++ b/halyde/core/termlib.lua @@ -44,7 +44,7 @@ gpu.setForeground(defaultForegroundColor) gpu.setBackground(defaultBackgroundColor) local function scrollDown() - width, height = gpu.getResolution() + local width, height = gpu.getResolution() if gpu.copy(1,1,width,height,0,-1) then local prevForeground = gpu.getForeground() local prevBackground = gpu.getBackground() @@ -66,7 +66,7 @@ local function newLine() end local function parseCodeNumbers(code) - o = {} + local o = {} for num in code:sub(3,-2):gmatch("[^;]+") do table.insert(o,tonumber(num)) end @@ -97,7 +97,7 @@ local function findCodeEnd(text,i) end function termlib.write(text, textWrap) - width, height = gpu.getResolution() + local width, height = gpu.getResolution() -- you don't know how tiring this was just for ANSI escape code support @@ -113,10 +113,10 @@ function termlib.write(text, textWrap) end text = tostring(text) text = "\27[0m" .. text:gsub("\t", " ") - readBreak = 0 + local readBreak = 0 -- readBreak is for when, inside the for loop, there normally would have been an increase in the "i" variable because it has read more than one character. -- unfortunately, changing the "i" variable would have unpredictable effects, so to not risk anything, this workaround was done. - section = "" + local section = "" local function printSection() if #section==0 then @@ -150,17 +150,17 @@ function termlib.write(text, textWrap) elseif string.byte(text,i)==0x1b and i<=#text-2 then printSection() --ocelot.log("0x1b char detected") - codeType = string.sub(text,i+1,i+1) + local codeType = string.sub(text,i+1,i+1) if codeType=="[" then -- Control Sequence Introducer --ocelot.log("Control Sequence Introducer") - codeEndIdx = findCodeEnd(text,i) + local codeEndIdx = findCodeEnd(text,i) -- codeEndIdx = string.find(text,"m",i) - code = string.sub(text,i,codeEndIdx) + local code = string.sub(text,i,codeEndIdx) --ocelot.log("Code: "..code.." ("..i..", "..codeEndIdx..")") readBreak = readBreak + #code - 1 - nums = parseCodeNumbers(code) - codeEnd = code:sub(-1) + local nums = parseCodeNumbers(code) + local codeEnd = code:sub(-1) --ocelot.log("Code end: "..codeEnd..", "..#codeEnd) if codeEnd == "m" then -- Select Graphic Rendition