~jaro/balkon

2065b3c41ecd53002bd23d77fcf30e2bb7dade14 — Jaro 1 year, 1 month ago 5fa1efb
Remove redundant overflow handling.

This may be useful later when words are allowed to overflow, but this
code path is currently unused.
1 files changed, 4 insertions(+), 5 deletions(-)

M src/Data/Text/ParagraphLayout/Internal/Plain.hs
M src/Data/Text/ParagraphLayout/Internal/Plain.hs => src/Data/Text/ParagraphLayout/Internal/Plain.hs +4 -5
@@ 100,15 100,11 @@ layoutLines maxWidth runs
    | null rest
        -- Everything fits. We are done.
        = fitting : []
    | null fitting
        -- Nothing fits. We must resolve this by overflowing.
        = overflowing : []
    | otherwise
        -- Something fits, the rest goes on the next line.
        = fitting : layoutLines maxWidth rest
    where
        (fitting, rest) = layoutAndWrapRunsH maxWidth runs
        overflowing = layoutRunsH runs

-- TODO: Allow a run across multiple spans (e.g. if they only differ by colour).



@@ 123,7 119,10 @@ positionLineH :: Int32 -> [WithSpan PF.ProtoFragment] ->
    (Int32, [WithSpan Fragment])
positionLineH originY pfs = (nextY, frags)
    where
        nextY = maximum $ map y_min rects
        -- A line with no glyphs will be considered to have zero height.
        -- This can happen when line breaking produces a line that contains
        -- onls spaces.
        nextY = if null rects then originY else maximum $ map y_min rects
        rects = map (\(WithSpan _ r) -> fragmentRect r) frags
        frags = snd $ mapAccumL (positionFragmentH originY) originX pfs
        originX = paragraphOriginX