Fix cursor positioning in selection sections

This commit is contained in:
2023-05-19 16:07:11 +01:00
parent 5604d7f1e3
commit 448669cd83
3 changed files with 9 additions and 6 deletions
+4 -3
View File
@@ -195,10 +195,11 @@ updateSection sis mcsel availablelines ss =
scurs = do
csel <- mcsel
(_, si) <- IM.lookupGE csel sis -- this is not right?
let cpos = sum (fmap (length . _siPictures) . 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)
@@ -245,7 +246,7 @@ updateSection sis mcsel availablelines ss =
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) * 10) 0 str
h (col, 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
@@ -305,7 +306,7 @@ enterCombineInv cfig w =
{ _ssItems = cm
, _ssCursor = do
(_, si) <- IM.lookupMin cm
return $ SectionCursor 0 (length (_siPictures si)) (_siColor si)
return $ SectionCursor 0 (_siHeight si) (_siColor si)
, _ssMinSize = 5
, _ssOffset = 0
, _ssShownItems = mempty