feat(CountersSelectors): add pageup/pagedown/home/end shortcuts
This commit is contained in:
parent
64176024f3
commit
4b7a38ebf0
@ -208,7 +208,9 @@ local function CountersSelector(initialCountersMap, config)
|
||||
|
||||
term.clear()
|
||||
local width, height = term.getSize()
|
||||
local mainWin = window.create(term.current(), 1, 1 + topHeight, width, height - topHeight)
|
||||
local mainHeight = height - topHeight
|
||||
local nbOfElemsPerPage = mainHeight
|
||||
local mainWin = window.create(term.current(), 1, 1 + topHeight, width, mainHeight)
|
||||
local titleWin = window.create(term.current(), 1, 1, width, 1 + topHeight)
|
||||
|
||||
local shouldContinue = true
|
||||
@ -222,6 +224,14 @@ local function CountersSelector(initialCountersMap, config)
|
||||
selectedCounter = math.max(1, selectedCounter - 1)
|
||||
elseif keyPressed == keys.down then
|
||||
selectedCounter = math.min(nbCounters, selectedCounter + 1)
|
||||
elseif keyPressed == keys.home then
|
||||
selectedCounter = 1
|
||||
elseif keyPressed == keys['end'] then
|
||||
selectedCounter = nbCounters
|
||||
elseif keyPressed == keys.pageUp then
|
||||
selectedCounter = math.max(1, selectedCounter - nbOfElemsPerPage)
|
||||
elseif keyPressed == keys.pageDown then
|
||||
selectedCounter = max.max(nbCounters, selectedCounter + nbOfElemsPerPage)
|
||||
elseif keyPressed == keys.left and globalCounter > 0 then
|
||||
if decrementSelectedCounter(countersMap, selectedCounter) then
|
||||
globalCounter = globalCounter - 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user