Refactor in lens direction

This commit is contained in:
2025-01-04 19:14:18 +00:00
parent 31a74b9ac0
commit 39e3e4ae00
9 changed files with 549485 additions and 824485 deletions
+8 -7
View File
@@ -303,17 +303,15 @@ updateSection indent mcsel sis availablelines oldoffset =
offset = fromMaybe oldoffsetbounded $ do
csel <- mcsel
maxcsel <- fst <$> IM.lookupMax sis
si <- sis ^? ix csel
let xselsize = length $ _siPictures si
xselsize <- fmap length $ sis ^? ix csel . siPictures
return $ case sum $ fmap (length . _siPictures) . fst . IM.split csel $ sis of
pos | pos == 0 || length allstrings <= availablelines -> 0
pos | pos - 1 < oldoffset -> pos - 1
pos | maxcsel == csel -> pos - availablelines + xselsize
pos
| pos + 1 + xselsize - availablelines > oldoffset ->
pos | pos + 1 + xselsize - availablelines > oldoffset ->
pos - availablelines + 1 + xselsize
_
| length allstrings - oldoffset < availablelines ->
-- _ | length allstrings - oldoffset < availablelines ->
_ | length allstrings - availablelines < oldoffset ->
length allstrings - availablelines
_ -> oldoffsetbounded
tweakfirst
@@ -330,9 +328,12 @@ updateSection indent mcsel sis availablelines oldoffset =
shownstrings = drop offset allstrings
listSelectionColorPicture :: SelectionItem a -> [STup.Pair Color Picture]
--listSelectionColorPicture si = []
listSelectionColorPicture si = g <$> _siPictures si
where
g str = _siColor si STup.:!: 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)
regexList :: String -> [String] -> Bool