Allow for scrolling in combine regex

This commit is contained in:
2023-02-13 23:15:34 +00:00
parent 8b39a99194
commit 9dd4c53316
10 changed files with 46 additions and 37 deletions
+7 -6
View File
@@ -10,16 +10,15 @@ import LensHelp
setShownIntMap :: SelectionIntMap a -> SelectionIntMap a
setShownIntMap sm = case sm ^. smRegex of
NoSMRegex -> sm & smShownItems .~ IM.fromAscList (zip [0..] allitms)
SMRegex str _ -> sm & smShownItems
Nothing -> sm & smShownItems .~ IM.fromAscList (zip [0..] allitms)
Just str -> sm & smShownItems
.~ IM.fromAscList (zip [0..] (f str : filter (regexList str . _siPictures) allitms))
where
allitms = sm ^. smItems
f str = SelectionInfo
f str = SelectionRegex
{ _siPictures = ["FILTER: " ++ str]
, _siHeight = 1
, _siIsSelectable = False
--, _siWidth = length ("FILTER: " ++ str)
, _siIsSelectable = True
, _siColor = white
, _siOffX = 0
}
@@ -27,7 +26,9 @@ setShownIntMap sm = case sm ^. smRegex of
initialSelPos :: SelectionIntMap a -> SelectionIntMap a
initialSelPos sm = sm & smSelPos .~ mi
where
mi = fst <$> ifind (const _siIsSelectable) (sm ^. smShownItems)
mi = fst <$> ifind t (sm ^. smShownItems)
t _ SelectionRegex{} = False
t _ si = _siIsSelectable si
-- assumes that at least one item is selectable!
-- also assumes that the integer is 1 or -1