Closed sschuberth closed 1 year ago
Mordant has to expand tabs to be able to lay out widgets properly. e.g. if a table cell contains \t
, it needs to know the width of that cell in order to draw table borders that line up. The only solution is to expand the tab. You can control the number of spaces used with the tabWidth
parameter to the Terminal
constructor.
Well, if you know via the tabWidth
value how many spaces a tab should evaluate to, you could calculate the width without actually expanding tabs, or?
Anyway, is this documented somewhere, like in a migration guide from regular System.out.print
to Mordant? Because in my case I had to (trivially) adjust several tests that were very strict about asserting CliktCommandTestResult.stdout
to contain literal tab chars.
could calculate the width without actually expanding tabs
No, because we don't know how wide a tab actually is. The actual tab width is set in whatever console/editor you're looking at the text. If we didn't expand tabs, the layouts would be messed up for anyone who uses a different tab width than you.
I agree that the tab expansion should be called out more prominently in the docs.
What I'm seeing is that
CliktCommandTestResult.stdout
capturingterminal.println("\t")
results in spaces instead of a tab character being returned. Now, I guess the issue could be anywhere from Mordant's terminal printing to Clikt's stdout caturing...