-
Notifications
You must be signed in to change notification settings - Fork 894
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
Bad formatting in rustup toolchain --help
#657
Comments
Hm, actually I don't think this runs through markdown. Is clap doing this? |
Yeah it looks like it's a feature of clap that it will wrap help text, it's in the 2.6 changelist. |
This also happens for other commands, e.g. part of the output of
|
This could be from the default term width being set to 120 in places like Windows where the term width isn't known. There are ways to override that if that is in fact what's happening. I'll look into this once I'm not on mobile and post back with what I find. |
So I did some checking, and it's because there are hard newlines in the formatted text, which I'm assuming are coming from the markdown or elsewhere. Then clap also inserts newlines every 120 when it can't determine the term width. So one of three things would fix it
There are pros and cons to each method. The biggest drawback of keeping the hard newlines is that on platforms where the term width can be determined (OSX, Linux, etc.), one could end up with weird formatting on lower resolution terminals, or one is responsible for keeping the formatting correct manually. |
This has been fixed with clap v2.10.3 One can now use |
@kbknapp Thank you <3 The next step here is to upgrade clap and set the term width per @kbknapp's direction. It looks to me like some of the text in help.rs is wrapped at different columns. Probably best to rewrap everything to ... 70 maybe. Then do a manual check of all the --help commands and see if it looks decent. But I wonder if this is the right approach and we shouldn't let clap do its wrapping. I suspect if we did the output would look unpleasing on wide screens. Really the best of all world would be for the output to use the wrapping as-written, unless the screen is narrow, then rewrap the paragraphs, but not the examples, or .. I don't know. Gets complicated. |
@brson I've just put in a PR for clap to help with this issue. See clap-rs/clap#650 This allows clap to ignore hard newlines, or rather treat them like inserted newlines by properly wrapping and aligning text and then restarting it's count until the next newline should be inserted. But it will also still wrap appropriately if the term width is smaller than the hard newlines allow. The one thing it won't change, it won't remove those hard newlines upon wrapping, but it still looks better than it did and I'd say solves this issue for the most part. Ref See clap-rs/clap#617 Once the PR merges I'll put v2.11.3 on crates.io |
@kbknapp Thank you! |
clap v2.11.3 is up on crates.io. Please let me know if this doesn't fix the issue, or something needs to be changed. |
When I run this I see:
Lots of bad line breaks. cc @Diggsey probably from the markdown processing?
The text was updated successfully, but these errors were encountered: