diff options
author | defanor <defanor@uberspace.net> | 2017-11-24 16:15:34 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-11-24 16:21:50 +0300 |
commit | e018f4248a7761649ed0e7cca03b544425584271 (patch) | |
tree | 32af14ca8a82defa3385ed10dc52c7baa22cd296 /Pancake | |
parent | 33efbfed5ee94820d3009d6ec3add7a48cf579f8 (diff) |
Don't skip empty lines
This is particularly important for code blocks.
Diffstat (limited to 'Pancake')
-rw-r--r-- | Pancake/Rendering.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Pancake/Rendering.hs b/Pancake/Rendering.hs index 8d0cd0c..5393b77 100644 --- a/Pancake/Rendering.hs +++ b/Pancake/Rendering.hs @@ -235,7 +235,7 @@ fitLines :: Int -> [StyledLine] -- ^ Fitted lines. fitLines 0 _ = [] -fitLines maxLen inlineBits = concatMap (map reverse . fitWords [] 0) inlineBits +fitLines maxLen inlineBits = concatMap (map reverse . fitWords') inlineBits where splitStyled :: Styled -> [Styled] splitStyled (Plain s) @@ -254,6 +254,11 @@ fitLines maxLen inlineBits = concatMap (map reverse . fitWords [] 0) inlineBits splitStyled (Superscript s) = map Superscript $ splitStyled s splitStyled (Fg c s) = map (Fg c) $ splitStyled s splitStyled (Denote d s) = map (Denote d) $ splitStyled s + fitWords' :: [Styled] -> [StyledLine] + fitWords' ws + -- handle empty lines + | null (unstyled ws) = [[]] + | otherwise = fitWords [] 0 ws fitWords :: [Styled] -> Int -> [Styled] -> [StyledLine] fitWords curLine curLen (w:ws) -- handle newline characters |