git.iko.soy/typeable/pandoc
on master help sign in
Simplify Text.Pandoc.Pretty.offset
509d2eaAlexander Krotov
src/Text/Pandoc/Pretty.hs+1−3
@@ -438,9 +438,7 @@ afterBreak s = Doc $ singleton (AfterBreak s)
438
438
439-- | Returns the width of a 'Doc'.
439-- | Returns the width of a 'Doc'.
440offset :: Doc -> Int
440offset :: Doc -> Int
441−offset d = case map realLength . lines . render Nothing $ d of
441+offset d = maximum (0: map realLength (lines $ render Nothing d))
442− [] -> 0
443− os -> maximum os
444
442
445-- | Returns the minimal width of a 'Doc' when reflowed at breakable spaces.
443-- | Returns the minimal width of a 'Doc' when reflowed at breakable spaces.
446minOffset :: Doc -> Int
444minOffset :: Doc -> Int