Improve inventory display

Extant bugs: can get to INVENTORY heading section when deleting nearby
filter if inventory is empty
This commit is contained in:
2025-01-06 11:08:09 +00:00
parent b59ebaf57d
commit bcc36901aa
+6 -37
View File
@@ -133,7 +133,7 @@ updateDisplaySections w cfig =
, nearbyhead
, sclose
, interfaceshead
, interfaces
, btitems
]
)
where
@@ -146,9 +146,10 @@ updateDisplaySections w cfig =
(sfclose, sclose) =
filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY ITEMS" $
w ^? hud . hudElement . diCloseFilter . _Just
nearbyhead = if null sfclose then makehead "NEARBY ITEMS" else sfclose
nearbyhead
| null sfclose && not (null sclose) = makehead "NEARBY ITEMS"
| otherwise = sfclose
interfaceshead = if null btitems then mempty else makehead "NEARBY INTERFACES"
interfaces = btitems
btitems =
IM.fromDistinctAscList . zip [0 ..] $
mapMaybe (closeButtonToSelectionItem w) (w ^. hud . closeButtons)
@@ -324,39 +325,7 @@ enterCombineInv cfig w =
w & hud . hudElement . subInventory
.~ CombineInventory
{ _ciSections = updateCombineSections w cfig mempty
, _ciSelection = selpos
, _ciSelection = Just (0,0,mempty)
, _ciFilter = Nothing
}
-- .~ CombineInventory
-- { _ciSections = IM.fromDistinctAscList [(-1, filtsection), (0, combsection)]
-- , _ciSelection = selpos
-- , _ciFilter = Nothing
-- }
& hud . hudElement . diInvFilter
.~ Nothing
where
cm' = IM.fromDistinctAscList . zip [0 ..] $ combineList w
cm
| null cm' =
IM.singleton 0 $
SelectionInfo ["No possible combinations"] 1 25 False white 0
| otherwise = cm'
selpos
| null cm' = Nothing
| otherwise = Just (0, 0, mempty)
filtsection =
SelectionSection
{ _ssItems = mempty
, _ssOffset = 0
, _ssShownItems = mempty
, _ssShownLength = 0
, _ssIndent = 0
}
combsection =
updateSection
0
(Just 0)
cm
availablelines
0
availablelines = getAvailableListLines secondColumnParams cfig
& hud . hudElement . diInvFilter .~ Nothing