diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index 252546335..d38e23f4c 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -296,10 +296,8 @@ updateSection indent mcsel sis availablelines oldoffset = SelectionSection { _ssItems = sis , _ssOffset = offset - , _ssShownItems = - tweakfirst . tweaklast . map (^. _2) $ - take availablelines shownstrings - , _ssShownLength = length shownitems + , _ssShownItems = shownitems + , _ssShownLength = min aslength availablelines , _ssIndent = indent } where diff --git a/src/Dodge/SelectionSections.hs b/src/Dodge/SelectionSections.hs index c83cb7132..da0e25472 100644 --- a/src/Dodge/SelectionSections.hs +++ b/src/Dodge/SelectionSections.hs @@ -196,12 +196,12 @@ selSecYint i j sss = do . fst $ IM.split j (ss ^. ssItems) where - secpos = sum . fmap (length . _ssShownItems) . fst $ IM.split i sss + secpos = sum . fmap _ssShownLength . fst $ IM.split i sss inverseSelSecYint :: Int -> IM.IntMap (SelectionSection a) -> Maybe (Int, Int) inverseSelSecYint yint sss = do ((i, ss), othersss) <- IM.minViewWithKey sss - let l = length $ _ssShownItems ss + let l = _ssShownLength ss if l <= yint then inverseSelSecYint (yint - l) othersss else do