Tweak combine filtering
This commit is contained in:
+11
-4
@@ -24,6 +24,11 @@ setShownIntMap sm = case sm ^. smRegex of
|
||||
, _siOffX = 0
|
||||
}
|
||||
|
||||
initialSelPos :: SelectionIntMap a -> SelectionIntMap a
|
||||
initialSelPos sm = sm & smSelPos .~ mi
|
||||
where
|
||||
mi = fst <$> ifind (const _siIsSelectable) (sm ^. smShownItems)
|
||||
|
||||
-- assumes that at least one item is selectable!
|
||||
-- also assumes that the integer is 1 or -1
|
||||
moveSelectionMapStep :: Int -> SelectionIntMap a -> SelectionIntMap a
|
||||
@@ -36,10 +41,12 @@ moveSelectionMapStep x sm = fromMaybe sm $ do
|
||||
_ -> Just $ moveSelectionMapStep x (sm & smSelPos ?~ j)
|
||||
|
||||
moveSelectionMapSelection :: Int -> SelectionIntMap a -> SelectionIntMap a
|
||||
moveSelectionMapSelection i sm = foldl'
|
||||
(&)
|
||||
sm
|
||||
(replicate (abs i) (moveSelectionMapStep (signum i)))
|
||||
moveSelectionMapSelection i sm
|
||||
| any _siIsSelectable (sm ^. smShownItems) = foldl'
|
||||
(&)
|
||||
sm
|
||||
(replicate (abs i) (moveSelectionMapStep (signum i)))
|
||||
| otherwise = sm & smSelPos .~ Nothing
|
||||
|
||||
getIthPos :: Int -> IM.IntMap (SelectionItem a) -> Int
|
||||
getIthPos i sm = sum . fmap _siHeight . fst $ IM.split i sm
|
||||
|
||||
Reference in New Issue
Block a user