Move towards selection section inventory management

This commit is contained in:
2023-02-14 23:25:09 +00:00
parent 9dd4c53316
commit ff5fa6321a
6 changed files with 252 additions and 66 deletions
+6 -3
View File
@@ -26,9 +26,12 @@ setShownIntMap sm = case sm ^. smRegex of
initialSelPos :: SelectionIntMap a -> SelectionIntMap a
initialSelPos sm = sm & smSelPos .~ mi
where
mi = fst <$> ifind t (sm ^. smShownItems)
t _ SelectionRegex{} = False
t _ si = _siIsSelectable si
mi = case sm ^? smShownItems . ix 0 of
Nothing -> Nothing
Just SelectionRegex {} -> case sm ^? smShownItems . ix 1 of
Nothing -> Just 0
Just _ -> Just 1
_ -> Just 0
-- assumes that at least one item is selectable!
-- also assumes that the integer is 1 or -1