Cleanup
This commit is contained in:
@@ -308,15 +308,14 @@ updateSection indent mcsel sis availablelines oldoffset =
|
||||
SelectionSection
|
||||
{ _ssItems = sis
|
||||
, _ssOffset = offset
|
||||
, _ssShownItems = tweakfirst shownitems
|
||||
-- , _ssShownItems = tweakfirst shownitems
|
||||
, _ssShownItems = tweakfirst . tweaklast . map snd
|
||||
$ take availablelines shownstrings
|
||||
, _ssIndent = indent
|
||||
}
|
||||
where
|
||||
nocursoroffset =
|
||||
if length allstrings - oldoffset <= availablelines
|
||||
then max 0 (length allstrings - availablelines)
|
||||
else oldoffset
|
||||
offset = fromMaybe nocursoroffset $ do
|
||||
oldoffsetbounded = max 0 . min oldoffset $ length allstrings - availablelines
|
||||
offset = fromMaybe oldoffsetbounded $ do
|
||||
csel <- mcsel
|
||||
maxcsel <- fst <$> IM.lookupMax sis
|
||||
si <- sis ^? ix csel
|
||||
@@ -331,19 +330,26 @@ updateSection indent mcsel sis availablelines oldoffset =
|
||||
_
|
||||
| length allstrings - oldoffset < availablelines ->
|
||||
length allstrings - availablelines
|
||||
_ -> oldoffset
|
||||
tweakfirst (x : xs)
|
||||
| offset > 0 =
|
||||
color moreupcolor (text (replicate 15 (toEnum 30))) :
|
||||
xs
|
||||
| otherwise = x : xs
|
||||
tweakfirst [] = []
|
||||
_ -> oldoffsetbounded
|
||||
tweakfirst
|
||||
| offset > 0 = ix 0 .~ color moreupcolor (text (replicate 15 (toEnum 30)))
|
||||
| otherwise = id
|
||||
-- tweakfirst (x : xs)
|
||||
-- | offset > 0 =
|
||||
-- color moreupcolor (text (replicate 15 (toEnum 30))) :
|
||||
-- xs
|
||||
-- | otherwise = x : xs
|
||||
-- tweakfirst [] = []
|
||||
moreupcolor = fromMaybe white $ allstrings ^? ix offset . _1
|
||||
shownitems
|
||||
| length shownstrings > availablelines =
|
||||
map snd (take (availablelines - 1) shownstrings)
|
||||
++ [color moredowncolor . text $ replicate 15 (toEnum 31)]
|
||||
| otherwise = map snd shownstrings
|
||||
tweaklast
|
||||
| length shownstrings > availablelines = ix (availablelines - 1)
|
||||
.~ color moredowncolor (text . replicate 15 $ toEnum 31)
|
||||
| otherwise = id
|
||||
-- shownitems
|
||||
-- | length shownstrings > availablelines =
|
||||
-- map snd (take (availablelines - 1) shownstrings)
|
||||
-- ++ [color moredowncolor . text $ replicate 15 (toEnum 31)]
|
||||
-- | otherwise = map snd shownstrings
|
||||
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1
|
||||
allstrings = listSelectionColorPicture sis
|
||||
shownstrings = drop offset allstrings
|
||||
|
||||
Reference in New Issue
Block a user