diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index d68d2d5af..d6ca9da94 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -7,6 +7,7 @@ module Dodge.DisplayInventory ( toggleCombineInv, ) where +import Data.IntSet (IntSet) import Control.Applicative import Control.Lens import Control.Monad @@ -48,7 +49,7 @@ updateCombineSections w cfig = updateSectionsPositioning (const 5) (const 0) - (fmap (\(x, y, _) -> (x, y)) $ w ^? hud . hudElement . subInventory . ciSelection . _Just) + (w ^? hud . hudElement . subInventory . ciSelection . _Just) (getAvailableListLines secondColumnParams cfig) [(0, sclose), (-1, sfclose)] where @@ -138,7 +139,7 @@ updateDisplaySections w cfig = , interfaces ] where - mselpos = fmap (\(x, y, _) -> (x, y)) $ w ^? hud . hudElement . diSelection . _Just + mselpos = w ^? hud . hudElement . diSelection . _Just invfiltcurs = mselpos ^? _Just . _1 == Just (-1) (sfinv, sinv) = filterSectionsPair invfiltcurs plainRegex invitems "INVENTORY" $ @@ -265,7 +266,7 @@ doSectionSize extraavailable mintaken is sss done = fromMaybe done $ do updateSectionsPositioning :: (Int -> Int) -> -- for determining each sections minimum size (Int -> Int) -> -- for determining each sections indent - Maybe (Int, Int) -> + Maybe (Int, Int, IntSet) -> Int -> [(Int, IM.IntMap (SelectionItem a))] -> IM.IntMap (SelectionSection a) -> @@ -275,13 +276,14 @@ updateSectionsPositioning f h mselpos allavailablelines lsss sss = where offsets = fmap _ssOffset sss m k = do - (k', i) <- mselpos + (k', i, _) <- mselpos guard $ k == k' return i ls = IM.fromList lsss -- defaults non-existing offsets to 0 g = merge (mapMissing (const ($ 0))) dropMissing (zipWithMatched (const ($))) - lk = maybe [] ((: []) . fst) mselpos + --lk = maybe [] ((: []) . fst) mselpos + lk = mselpos ^.. _Just . _1 ssizes = sectionsSizes allavailablelines