Wrapping: Don't try to wrap if width is <1

This commit is contained in:
Ali Abrar 2018-11-03 15:00:28 -04:00
parent cc3df47591
commit 03f748031e

View File

@ -443,6 +443,7 @@ wrapText maxWidth attrs = V.vertCat
. T.split (=='\n')
wrapWithOffset :: Int -> Int -> Text -> [Text]
wrapWithOffset maxWidth _ _ | maxWidth <= 0 = []
wrapWithOffset maxWidth n xs =
let (firstLine, rest) = T.splitAt (maxWidth - n) xs
in firstLine : (fmap (T.take maxWidth) . takeWhile (not . T.null) . iterate (T.drop maxWidth) $ rest)