Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
typesanitizer opened this issue Nov 22, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@typesanitizer
Copy link
Owner

typesanitizer commented Nov 22, 2018

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 typesanitizer added the bug Something isn't working label Nov 22, 2018
@typesanitizer
Copy link
Owner Author

typesanitizer commented Nov 22, 2018

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 typesanitizer changed the title Item table rendering isn't correct when flag overflows Item table rendering isn't correct when flag overflows onto next line Nov 22, 2018
@typesanitizer
Copy link
Owner Author

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
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant