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

fix(help): Don't wrap URLs #3692

Merged
merged 1 commit into from
May 4, 2022
Merged

fix(help): Don't wrap URLs #3692

merged 1 commit into from
May 4, 2022

Conversation

epage
Copy link
Member

@epage epage commented May 4, 2022

Confusingly, there are two similar but slightly different settings in
textwrap. We need both set.

Fixes #3222

Confusingly, there are two similar but slightly different settings in
`textwrap`.  We need both set.

Fixes clap-rs#3222
@epage epage merged commit 41a8a5b into clap-rs:master May 4, 2022
@epage epage deleted the break branch May 4, 2022 21:47
@mgeisler
Copy link
Contributor

mgeisler commented Sep 14, 2022

Confusingly, there are two similar but slightly different settings in textwrap. We need both set.

Hi @epage,

Yeah, the break_words setting is about (forcibly) breaking words which are too wide to fit on the line. The word_splitter setting is about finding legal split points inside words (e.g., for hyphenation).

If you like, you could use a custom word splitter which would detect URLs and not split on embedded hyphens — but which would still allow splitting at other hyphens. Let me know if you would be interested in that kind of functionality?

@epage
Copy link
Member Author

epage commented Sep 14, 2022

Yeah, the break_words setting is about (forcibly) breaking words which are too wide to fit on the line. The word_splitter setting is about finding legal split points inside words (e.g., for hyphenation).

The issue was more so in seeing and using one, thinking that that was all that was needed.

@mgeisler
Copy link
Contributor

The issue was more so in seeing and using one, thinking that that was all that was needed.

Yeah, I'm not sure the option names are the best, to be honest. I've considered renaming them to something like break_long_words and hyphenation instead to make their purpose more clear... Thanks for the feedback, these data points are useful!

@epage
Copy link
Member Author

epage commented Sep 15, 2022

I think cross-linking them in the docs would be a big help.

@mgeisler
Copy link
Contributor

Great idea, this is now done: mgeisler/textwrap#471 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrectly splitting a URL (when wrapping)
2 participants