Add strict tuples
This commit is contained in:
@@ -8,6 +8,7 @@ module Dodge.DisplayInventory (
|
|||||||
toggleCombineInv,
|
toggleCombineInv,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified Data.Strict.Tuple as STup
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
@@ -90,10 +91,9 @@ updateInventoryPositioning u =
|
|||||||
%~ checkInventorySelectionExists
|
%~ checkInventorySelectionExists
|
||||||
|
|
||||||
checkInventorySelectionExists :: World -> World
|
checkInventorySelectionExists :: World -> World
|
||||||
checkInventorySelectionExists w =
|
checkInventorySelectionExists w
|
||||||
case w ^? hud . hudElement . diSections . ix i . ssItems . ix j of
|
| isJust $ w ^? hud . hudElement . diSections . ix i . ssItems . ix j = w
|
||||||
Nothing -> scrollAugNextInSection w
|
| otherwise = scrollAugNextInSection w
|
||||||
_ -> w
|
|
||||||
where
|
where
|
||||||
(i, j, _) = fromMaybe (1, -1, mempty) $ w ^? hud . hudElement . diSelection . _Just
|
(i, j, _) = fromMaybe (1, -1, mempty) $ w ^? hud . hudElement . diSelection . _Just
|
||||||
|
|
||||||
@@ -279,14 +279,8 @@ updateSectionsPositioning f h mselpos allavailablelines lsss sss =
|
|||||||
ls = IM.fromList lsss
|
ls = IM.fromList lsss
|
||||||
-- defaults non-existing offsets to 0
|
-- defaults non-existing offsets to 0
|
||||||
g = merge (mapMissing (const ($ 0))) dropMissing (zipWithMatched (const ($)))
|
g = merge (mapMissing (const ($ 0))) dropMissing (zipWithMatched (const ($)))
|
||||||
--lk = maybe [] ((: []) . fst) mselpos
|
|
||||||
lk = mselpos ^.. _Just . _1
|
lk = mselpos ^.. _Just . _1
|
||||||
ssizes =
|
ssizes = sectionsSizes allavailablelines f lk $ sectionsDesiredLines ls
|
||||||
sectionsSizes
|
|
||||||
allavailablelines
|
|
||||||
f
|
|
||||||
lk
|
|
||||||
$ sectionsDesiredLines ls
|
|
||||||
|
|
||||||
updateSection ::
|
updateSection ::
|
||||||
Int ->
|
Int ->
|
||||||
@@ -300,7 +294,7 @@ updateSection indent mcsel sis availablelines oldoffset =
|
|||||||
{ _ssItems = sis
|
{ _ssItems = sis
|
||||||
, _ssOffset = offset
|
, _ssOffset = offset
|
||||||
, _ssShownItems =
|
, _ssShownItems =
|
||||||
tweakfirst . tweaklast . map snd $
|
tweakfirst . tweaklast . map (^. _2) $
|
||||||
take availablelines shownstrings
|
take availablelines shownstrings
|
||||||
, _ssIndent = indent
|
, _ssIndent = indent
|
||||||
}
|
}
|
||||||
@@ -335,10 +329,10 @@ updateSection indent mcsel sis availablelines oldoffset =
|
|||||||
allstrings = foldMap listSelectionColorPicture sis
|
allstrings = foldMap listSelectionColorPicture sis
|
||||||
shownstrings = drop offset allstrings
|
shownstrings = drop offset allstrings
|
||||||
|
|
||||||
listSelectionColorPicture :: SelectionItem a -> [(Color, Picture)]
|
listSelectionColorPicture :: SelectionItem a -> [STup.Pair Color Picture]
|
||||||
listSelectionColorPicture si = g <$> _siPictures si
|
listSelectionColorPicture si = g <$> _siPictures si
|
||||||
where
|
where
|
||||||
g str = (_siColor si, translate lindent 0 . color (_siColor si) $ text str)
|
g str = _siColor si STup.:!: translate lindent 0 (color (_siColor si) $ text str)
|
||||||
lindent = 100 * fromIntegral (_siOffX si)
|
lindent = 100 * fromIntegral (_siOffX si)
|
||||||
|
|
||||||
regexList :: String -> [String] -> Bool
|
regexList :: String -> [String] -> Bool
|
||||||
|
|||||||
Reference in New Issue
Block a user