Closed amigalemming closed 3 years ago
Actually, is there any reason for these spaces to be there at all?
Actually, is there any reason for these spaces to be there at all?
agree, we had the same question https://github.com/cdepillabout/purescript-boxes/pull/4#issuecomment-776674950
I have proposed to remove them on render
render = unlines <<< map trimEnd <<< renderBox
The reason is that it would give better diffs in tests
E.g.
You have a text file with golden/expected state
foo
barbar
but then boxes
renders you the same, but with spaces appended
foo<3 spaces>
barbar
and diff fails
@byorgey @treeow
I have vertically stacked text boxes of differing widths. When rendered they are all right padded with white spaces. A single box of large width causes lots of padded small boxes. The padding allows additional line breaks in a terminal if it is too narrow. Although this behavior is correct it can be annoying. How about an alternative rendering function that emits only the spaces that are necessary for formatting? Maybe it should even be a rendering function that allows formatting options that can be extended in the future.