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

Help text for rustup update contains a broken URL when line-broken #2920

Closed
ketsuban opened this issue Dec 8, 2021 · 5 comments · Fixed by #3064
Closed

Help text for rustup update contains a broken URL when line-broken #2920

ketsuban opened this issue Dec 8, 2021 · 5 comments · Fixed by #3064
Labels
not-rustup Whatever is described in this issue isn't Rustup's fault

Comments

@ketsuban
Copy link

ketsuban commented Dec 8, 2021

Problem

Some terminals (including Windows Terminal) provide a mechanism for opening URLs in the default browser when you Ctrl-click on them. The help text for rustup update contains the URL https://github.com/rust-lang/rustup/wiki/Non-host-toolchains; however, if this gets broken across two lines the resulting URL is https://github.com/rust or https://github.com/rust-, which don't go where they're supposed to.

Steps

  1. Execute the command rustup help update.

Possible Solution(s)

No response

Notes

Obviously this requires a sufficiently small terminal window to word-wrap the help text.

Rustup version

rustup 1.24.3 (ce5817a94 2021-05-31)

Installed toolchains

Default host: x86_64-pc-windows-gnu
rustup home:  C:\Users\Thomas Winwood\.rustup

installed toolchains
--------------------

stable-x86_64-pc-windows-gnu (default)
nightly-x86_64-pc-windows-gnu

active toolchain
----------------

stable-x86_64-pc-windows-gnu (default)
rustc 1.57.0 (f1edd0429 2021-11-29)
@ketsuban ketsuban added the bug label Dec 8, 2021
@kinnison kinnison added not-rustup Whatever is described in this issue isn't Rustup's fault and removed bug labels Dec 27, 2021
@kinnison
Copy link
Contributor

If this is a bug in Rustup, it would likely be in the markdown linewrapper we have, which is pretty simplistic, however looking through that code I cannot see how it would ever split a link across multiple lines. As such this is almost certainly a bug in the terminal you are using. If I deliberately cause a link to be split across multiple lines in my terminal, it is still correctly identified as a single link.

Is there something we can do to cause Windows terminal to detect the continuation of the link?

@ketsuban
Copy link
Author

I did some additional testing and the line in question is wrapped so as to break the URL regardless of the width of the terminal window, so it's not Windows Terminal at fault.

@kinnison
Copy link
Contributor

@ketsuban Fascinating. Let me look again.

Oh, this isn't help text when running the command, you mean --help on the CLI. Hmm

It looks like this is part of the wrap_help feature of clap (the CLI parser we use). We'd need to be certain that turning that off won't result in unpleasant UX for others before we'd consider it. Perhaps the clap authors could chime in on whether or not they could detect URLs and not split the words. This remains "not-rustup` in the sense that it's not our fault per-se, but we could do with some input from clap.

I am able to force the same bad behaviour, so I have filed clap-rs/clap#3222 and we'll see what they say

@mgeisler
Copy link
Contributor

It looks like this is part of the wrap_help feature of clap (the CLI parser we use). We'd need to be certain that turning that off won't result in unpleasant UX for others before we'd consider it.

Hi @kinnison, I'm the maintainer of Textwrap, the underlying wrapping library used by Clap. I just created a PR (#3070) to enable the wrap_help feature in Clap. The feature seems to be optional and not enabled by default. That helps with the display of text and without it, I find that the help texts look odd. Clap stopped wrapping URLs after clap-rs/clap#3692.

@mgeisler
Copy link
Contributor

Clap stopped wrapping URLs after clap-rs/clap#3692.

I just checked the Clap changelog and this fix was released in Clap 3.1.16. Rustup is using Clap 2, so an upgrade will be needed to fix this properly. That upgrade is already prepared in #3064 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-rustup Whatever is described in this issue isn't Rustup's fault
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants