ozil icon indicating copy to clipboard operation
ozil copied to clipboard

Item table rendering isn't correct when flag overflows onto next line

Open typesanitizer opened this issue 7 years ago • 3 comments

If you look at fd

screenshot from 2018-11-22 12-01-30

We use a constant padding instead of a constant width, which causes the description to shift to the left.

One problem is that we can't make a table by combining the two columns first and then gluing the two columns side by side, as the rows in the description might overflow. Hmm, how do we get a proper table...

typesanitizer avatar Nov 22 '18 17:11 typesanitizer

fd appears to be doing something extremely strange. It somehow detects the width of the terminal and prints the help accordingly? What sorcery is this? Do we even need to support fd or maybe try using some other test program?

Wide terminal

screenshot from 2018-11-22 12-41-04

Narrow terminal

screenshot from 2018-11-22 12-41-29

Even narrow terminal

screenshot from 2018-11-22 12-42-26

EDIT - Actually this isn't sorcery, it is just alternate behaviour. The program does have to do IO anyways when it prints all the descriptions aligned to the same width (because it has to know the terminal width to compute breaks, to insert newlines and padding), fd's CLI package is just smarter in that it tries to preserve readability. Hmm....

typesanitizer avatar Nov 22 '18 17:11 typesanitizer

For simplicity of testing, it would be better to use hlint or some other "normal" CLI app, instead of fd to avoid getting the results mixed up with fd's own behaviour.

typesanitizer avatar Nov 22 '18 18:11 typesanitizer

For inspiration, it might be helpful to look at hCenter and related functions on how to implement this with minimal fuss.

typesanitizer avatar Nov 22 '18 18:11 typesanitizer