fix(CountersSelector): better window clear strategy
This commit is contained in:
parent
bd843779e2
commit
8ece6948e5
@ -206,13 +206,14 @@ local function CountersSelector(initialCountersMap, config)
|
|||||||
|
|
||||||
local topHeight = 1
|
local topHeight = 1
|
||||||
|
|
||||||
term.clear()
|
-- term.clear()
|
||||||
local width, height = term.getSize()
|
local width, height = term.getSize()
|
||||||
local mainHeight = height - topHeight
|
local mainHeight = height - topHeight
|
||||||
local nbOfElemsPerPage = mainHeight
|
local nbOfElemsPerPage = mainHeight
|
||||||
local mainWin = window.create(term.current(), 1, 1 + topHeight, width, mainHeight)
|
local mainWin = window.create(term.current(), 1, 1 + topHeight, width, mainHeight)
|
||||||
local titleWin = window.create(term.current(), 1, 1, width, 1 + topHeight)
|
local titleWin = window.create(term.current(), 1, 1, width, 1 + topHeight)
|
||||||
|
|
||||||
|
local forceExited = false
|
||||||
local shouldContinue = true
|
local shouldContinue = true
|
||||||
while shouldContinue do
|
while shouldContinue do
|
||||||
renderTitle(titleWin, countersMap, selectedCounter, titleFn)
|
renderTitle(titleWin, countersMap, selectedCounter, titleFn)
|
||||||
@ -253,10 +254,18 @@ local function CountersSelector(initialCountersMap, config)
|
|||||||
shouldContinue = false
|
shouldContinue = false
|
||||||
elseif keyPressed == keys.q then
|
elseif keyPressed == keys.q then
|
||||||
os.pullEvent('key_up') -- fix to avoid writing a 'q' in the terminal on exit
|
os.pullEvent('key_up') -- fix to avoid writing a 'q' in the terminal on exit
|
||||||
return nil
|
shouldContinue = false
|
||||||
|
forceExited = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mainWin.clear()
|
||||||
|
titleWin.clear()
|
||||||
|
|
||||||
|
if forceExited then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
return countersMap, selectedCounter
|
return countersMap, selectedCounter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user