From c4b6445c2309b6a3c872bfcb875b67e21768545c Mon Sep 17 00:00:00 2001 From: WahPlus Date: Thu, 30 Oct 2025 14:21:02 +0200 Subject: [PATCH] Improve variable naming in halyde/kernel/modules/terminal.lua terminal.read() --- halyde/kernel/modules/terminal.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/halyde/kernel/modules/terminal.lua b/halyde/kernel/modules/terminal.lua index 8c36d1f..b7691a9 100644 --- a/halyde/kernel/modules/terminal.lua +++ b/halyde/kernel/modules/terminal.lua @@ -301,21 +301,21 @@ function module.init() end return math.min(y,height) end - local function set(idx,chr,rev) -- FIXME: Very clear variable naming... I would fix it but I don't even know what they mean. - if chr==nil or chr=="" then return end - if rev then + local function set(index, character, invertedColors) + if character==nil or character=="" then return end + if invertedColors then gpu.setForeground(bg) gpu.setBackground(fg) else gpu.setForeground(fg) gpu.setBackground(bg) end - idx=startX+idx-1 - local setX, setY = (idx-1)%width+1, startY+((idx-1)//width+1)-1 + index=startX+index-1 + local setX, setY = (index-1)%width+1, startY+((index-1)//width+1)-1 setY = checkScroll(setY) - gpu.set(setX,setY,unicode.sub(chr,1,width-setX+1)) - for i=1,math.ceil((#chr+setX-1)/width)+1 do - gpu.set(1,setY+i,unicode.sub(chr,2-setX+i*width,width+i*width-setX)) + gpu.set(setX,setY,unicode.sub(character,1,width-setX+1)) + for i=1,math.ceil((#character+setX-1)/width)+1 do + gpu.set(1,setY+i,unicode.sub(character,2-setX+i*width,width+i*width-setX)) setY = checkScroll(setY) end end