fix(CountersSelector): bad writeLine function

This commit is contained in:
Guillaume ARM 2024-05-23 21:58:41 +02:00
parent 7f7d3e801e
commit 4903f0a96c

View File

@ -31,15 +31,15 @@ local function withColor(win, textColor, backgroundColor, callbackFn)
return table.unpack(result) return table.unpack(result)
end end
local function createWriteWithColor(textColor, backgroundColor, givenWin) -- local function createWriteWithColor(textColor, backgroundColor, givenWin)
local win = givenWin or term -- local win = givenWin or term
return function(str) -- return function(str)
return withColor(win, textColor, backgroundColor, function() -- return withColor(win, textColor, backgroundColor, function()
return win.write(str) -- return win.write(str)
end) -- end)
end -- end
end -- end
local function getTotalCount(countersMap) local function getTotalCount(countersMap)
local total = 0 local total = 0
@ -105,7 +105,9 @@ local function renderCountersMap(win, countersMap, selectedCounter)
for k,v in pairs(displayedCounters) do for k,v in pairs(displayedCounters) do
win.setCursorPos(1, cursorYIndex) win.setCursorPos(1, cursorYIndex)
local writeLine = function() return tostring(v.name) .. ' ' .. tostring(v.count) end local writeLine = function()
win.write(tostring(v.name) .. ' ' .. tostring(v.count))
end
if k == selectedCounter then if k == selectedCounter then
withColor(win, colors.black, colors.white, writeLine) withColor(win, colors.black, colors.white, writeLine)