From 4903f0a96cefd4af567a1daf3b5ab844ead5543b Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Thu, 23 May 2024 21:58:41 +0200 Subject: [PATCH] fix(CountersSelector): bad writeLine function --- libs/ui/CountersSelector.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libs/ui/CountersSelector.lua b/libs/ui/CountersSelector.lua index 891d35c..e88d77d 100644 --- a/libs/ui/CountersSelector.lua +++ b/libs/ui/CountersSelector.lua @@ -31,15 +31,15 @@ local function withColor(win, textColor, backgroundColor, callbackFn) return table.unpack(result) end -local function createWriteWithColor(textColor, backgroundColor, givenWin) - local win = givenWin or term +-- local function createWriteWithColor(textColor, backgroundColor, givenWin) +-- local win = givenWin or term - return function(str) - return withColor(win, textColor, backgroundColor, function() - return win.write(str) - end) - end -end +-- return function(str) +-- return withColor(win, textColor, backgroundColor, function() +-- return win.write(str) +-- end) +-- end +-- end local function getTotalCount(countersMap) local total = 0 @@ -105,7 +105,9 @@ local function renderCountersMap(win, countersMap, selectedCounter) for k,v in pairs(displayedCounters) do 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 withColor(win, colors.black, colors.white, writeLine)