Improve variable naming in halyde/kernel/modules/terminal.lua terminal.read()
This commit is contained in:
@@ -301,21 +301,21 @@ function module.init()
|
|||||||
end
|
end
|
||||||
return math.min(y,height)
|
return math.min(y,height)
|
||||||
end
|
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.
|
local function set(index, character, invertedColors)
|
||||||
if chr==nil or chr=="" then return end
|
if character==nil or character=="" then return end
|
||||||
if rev then
|
if invertedColors then
|
||||||
gpu.setForeground(bg)
|
gpu.setForeground(bg)
|
||||||
gpu.setBackground(fg)
|
gpu.setBackground(fg)
|
||||||
else
|
else
|
||||||
gpu.setForeground(fg)
|
gpu.setForeground(fg)
|
||||||
gpu.setBackground(bg)
|
gpu.setBackground(bg)
|
||||||
end
|
end
|
||||||
idx=startX+idx-1
|
index=startX+index-1
|
||||||
local setX, setY = (idx-1)%width+1, startY+((idx-1)//width+1)-1
|
local setX, setY = (index-1)%width+1, startY+((index-1)//width+1)-1
|
||||||
setY = checkScroll(setY)
|
setY = checkScroll(setY)
|
||||||
gpu.set(setX,setY,unicode.sub(chr,1,width-setX+1))
|
gpu.set(setX,setY,unicode.sub(character,1,width-setX+1))
|
||||||
for i=1,math.ceil((#chr+setX-1)/width)+1 do
|
for i=1,math.ceil((#character+setX-1)/width)+1 do
|
||||||
gpu.set(1,setY+i,unicode.sub(chr,2-setX+i*width,width+i*width-setX))
|
gpu.set(1,setY+i,unicode.sub(character,2-setX+i*width,width+i*width-setX))
|
||||||
setY = checkScroll(setY)
|
setY = checkScroll(setY)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user