lib: Update textConcatTopPadded to use Tabular.AsciiWide, same as concatTopPadded.

This commit is contained in:
Stephen Morgan 2021-01-13 16:21:13 +11:00 committed by Simon Michael
parent 2c2bd8b27e
commit 9ad0eef69b

View File

@ -195,15 +195,9 @@ textUnbracket s
-- | Join several multi-line strings as side-by-side rectangular strings of the same height, top-padded. -- | Join several multi-line strings as side-by-side rectangular strings of the same height, top-padded.
-- Treats wide characters as double width. -- Treats wide characters as double width.
textConcatTopPadded :: [Text] -> Text textConcatTopPadded :: [Text] -> Text
textConcatTopPadded ts = T.intercalate "\n" $ map T.concat $ transpose padded textConcatTopPadded = TL.toStrict . renderRow def{tableBorders=False, borderSpaces=False}
where . Group NoLine . map (Header . cell)
lss = map T.lines ts :: [[Text]] where cell = alignCell BottomLeft
h = maximum $ map length lss
ypad ls = replicate (difforzero h (length ls)) "" ++ ls
xpad ls = map (textPadLeftWide w) ls
where w | null ls = 0
| otherwise = maximum $ map textWidth ls
padded = map (xpad . ypad) lss :: [[Text]]
-- -- | Join several multi-line strings as side-by-side rectangular strings of the same height, bottom-padded. -- -- | Join several multi-line strings as side-by-side rectangular strings of the same height, bottom-padded.
-- -- Treats wide characters as double width. -- -- Treats wide characters as double width.