Cleanup, stop drawing space characters

This commit is contained in:
2023-05-19 18:24:53 +01:00
parent 448669cd83
commit 03b793802f
5 changed files with 9 additions and 14 deletions
+3 -8
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-}
--{-# LANGUAGE TupleSections #-}
--{-# OPTIONS_GHC -fno-full-laziness #-}
@@ -195,11 +195,10 @@ updateSection sis mcsel availablelines ss =
scurs = do
csel <- mcsel
(_, si) <- IM.lookupGE csel sis -- this is not right?
let cpos = sum (fmap ( _siHeight) . fst . IM.split csel $ sis)
let cpos = sum (fmap _siHeight . fst . IM.split csel $ sis)
csize = length $ _siPictures si
ccolor = _siColor si
return $ SectionCursor (cpos - offset) csize ccolor
--return $ SectionCursor (cpos - offset) 1 ccolor
nocursoroffset =
if length allstrings - oldoffset <= availablelines
then max 0 (length allstrings - availablelines)
@@ -242,19 +241,15 @@ updateSection sis mcsel availablelines ss =
| otherwise = tweakfirst shownstrings
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1
allstrings :: [(Color, Picture)]
--allstrings = foldMap g sis
allstrings = IM.elems $ overlapSelectionItems $ IM.elems sis
shownstrings = drop offset allstrings
--h (col, str) = color col . text $ theindent ++ str
h (col, str) = translate (fromIntegral (_ssIndent ss) * 100) 0 str
h (_, str) = translate (fromIntegral (_ssIndent ss) * 100) 0 str
theindent = replicate (_ssIndent ss) ' '
--xtra str = color white . text $ theindent ++ str ++ " MORE " ++ _ssDescriptor ss
g si = map (_siColor si,) $ _siPictures si
overlapSelectionItems :: [SelectionItem a] -> IM.IntMap (Color, Picture)
overlapSelectionItems = go 0
where
--go :: Int -> [SelectionItem a] -> IM.IntMap (Picture,Color)
go _ [] = mempty
go i (si : xs) = doinsert $ go (i + _siHeight si) xs
where