Push more data out of selection list into menu screen

This commit is contained in:
2022-12-22 11:12:41 +00:00
parent a8fa1e9949
commit 6ac4e5d669
5 changed files with 33 additions and 32 deletions
+8 -6
View File
@@ -1,18 +1,20 @@
module Dodge.SelectionList where
--import Color
--import Dodge.WindowLayout
import Dodge.Data.Universe
import LensHelp
import Data.Maybe
setShownSelectionItems :: ScreenLayer -> ScreenLayer
setShownSelectionItems sl = fromMaybe sl $ do
setShownSelectionItems :: Configuration -> ScreenLayer -> ScreenLayer
setShownSelectionItems cfig sl = fromMaybe sl $ do
offset <- sl ^? scOffset
return $ sl & scSelectionList %~ setShownSelectionItems' offset
maxlines <- sl ^? scAvailableLines
return $ sl & scSelectionList %~ setShownSelectionItems' maxlines offset
setShownSelectionItems' :: Int -> SelectionList -> SelectionList
setShownSelectionItems' offset sl = case sl ^? slSizeRestriction of
Just (SelectionSizeRestriction maxlines _ botit _)
setShownSelectionItems' :: Int -> Int -> SelectionList -> SelectionList
setShownSelectionItems' maxlines offset sl = case sl ^? slSizeRestriction of
Just (SelectionSizeRestriction botit)
| length allitems > maxlines ->
sl & slShownItems .~ take (maxlines - 2) (drop offset allitems) -- ++ repeat dummyitem))
++ [(botit,ScrollSelectionItem)]