Stop equip after combining

This commit is contained in:
2023-05-15 06:46:09 +01:00
parent 1cec50c5ab
commit 0735b46266
13 changed files with 38 additions and 112 deletions
-35
View File
@@ -3,13 +3,10 @@ module Dodge.SelectionList (
getAvailableListLines,
) where
import Color
import Data.Maybe
import Dodge.Data.ScreenPos
import Dodge.Data.Universe
import LensHelp
import Linear
import Regex
getAvailableListLines :: ListDisplayParams -> Configuration -> Int
getAvailableListLines ldps cfig = floor ((dToBot - vgap) / itmHeight)
@@ -25,35 +22,3 @@ getShownItems :: SelectionList a -> [SelectionItem a]
getShownItems sl = case sl ^. slRegexList of
[] -> sl ^. slItems
xs -> fmap fst xs
makeRegexList :: SelectionList a -> [(SelectionItem a, Maybe Int)]
makeRegexList sl = case sl ^. slRegex of
"" | not (sl ^. slRegexInput) -> []
str ->
( SelectionInfo
{ _siPictures = ["FILTER: " ++ str]
, _siHeight = 1
, _siIsSelectable = False
, --, _siWidth = length $ "FILTER: "++str
_siColor = white
, _siOffX = 0
}
, Nothing
) :
filter (doregex str) (zip (_slItems sl) $ fmap Just [0 ..])
where
doregex str = regexList str . _siPictures . fst
setShownItems :: SelectionList a -> SelectionList a
setShownItems sl = sl & slRegexList .~ makeRegexList sl
moveSelectionListSelection :: Int -> SelectionList a -> SelectionList a
moveSelectionListSelection yi sl = sl & slSelPos %~ f
where
f x
| maxsel == 0 = Nothing
| isNothing x = Just 0
| otherwise = fmap ((`mod` maxsel) . subtract yi) x
maxsel = case _slRegex sl of
"" -> length (_slItems sl)
_ -> length (_slRegexList sl)