Cleanup, tweak selection sections positioning
This commit is contained in:
@@ -58,7 +58,7 @@ updateCombineSections w cfig sss =
|
||||
return $
|
||||
IM.singleton
|
||||
0
|
||||
(SelectionRegex ["COMBINATIONS FILTER: " ++ str, numfiltitems] 2 True white 0)
|
||||
(SelectionInfo ["COMBINATIONS FILTER: " ++ str, numfiltitems] 2 True white 0)
|
||||
mstr = w ^? hud . hudElement . subInventory . ciSections . sssExtra . sssFilters . ix (-1) . _Just
|
||||
numfiltitems = " " ++ show (length allcombs - length filtcombs) ++ " FILTERED"
|
||||
|
||||
@@ -108,7 +108,7 @@ updateDisplaySections w cfig sss =
|
||||
coitems' =
|
||||
IM.fromDistinctAscList . zip [0 ..] $
|
||||
map closeObjectToSelectionItem (w ^. hud . closeObjects)
|
||||
invitems' = IM.mapWithKey (invSelectionItem' cr) inv
|
||||
invitems' = IM.mapWithKey (invSelectionItem cr) inv
|
||||
cr = you w
|
||||
inv = _crInv (you w)
|
||||
nfreeslots = crNumFreeSlots cr
|
||||
@@ -123,7 +123,7 @@ updateDisplaySections w cfig sss =
|
||||
return $
|
||||
IM.singleton
|
||||
0
|
||||
(SelectionRegex [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0)
|
||||
(SelectionInfo [filtdescription ++ "FILTER: " ++ str, numfiltitems] 2 True white 0)
|
||||
itms' = fromMaybe itms $ do
|
||||
str <- mstr
|
||||
return $ IM.filter (plainRegex str) itms
|
||||
@@ -136,10 +136,10 @@ updateInventorySectionItems w = w
|
||||
where
|
||||
f olditems = fromMaybe olditems $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
invitms <- cr ^? crInv
|
||||
invitms <- IM.mapWithKey (invSelectionItem cr) <$> cr ^? crInv
|
||||
return $ case w ^? hud . hudElement . diSections . sssExtra . sssFilters . ix (-1) . _Just of
|
||||
Just str -> IM.filter (plainRegex str) $ IM.mapWithKey (invSelectionItem' cr) invitms
|
||||
_ -> IM.mapWithKey (invSelectionItem' cr) invitms
|
||||
Just str -> IM.filter (plainRegex str) invitms
|
||||
_ -> invitms
|
||||
|
||||
plainRegex :: String -> SelectionItem a -> Bool
|
||||
plainRegex = flip $ andOrRegex (\si str -> regexList str (_siPictures si))
|
||||
@@ -193,7 +193,10 @@ updateSection sis mcsel availablelines ss =
|
||||
csize = length $ _siPictures si
|
||||
ccolor = _siColor si
|
||||
return $ SectionCursor (cpos - offset) csize ccolor
|
||||
offset = fromMaybe oldoffset $ do
|
||||
nocursoroffset = if length allstrings - oldoffset <= availablelines
|
||||
then max 0 (length allstrings - availablelines)
|
||||
else oldoffset
|
||||
offset = fromMaybe nocursoroffset $ do
|
||||
csel <- mcsel
|
||||
maxcsel <- fst <$> IM.lookupMax sis
|
||||
si <- sis ^? ix csel
|
||||
|
||||
Reference in New Issue
Block a user