Use a simpler word separator algorithm to keep URLs intact.

This commit is contained in:
Justus Winter 2024-11-19 13:07:05 +01:00
parent c35efb18eb
commit 14c6c12a96
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386
2 changed files with 5 additions and 1 deletions

View File

@ -56,7 +56,7 @@ serde = { version = "1.0.137", features = ["derive"] }
subplotlib = { version = ">=0.7, <0.12", optional = true }
terminal_size = ">=0.2.6, <0.5"
termcolor = "1.2.0"
textwrap = ">=0.15, <0.17"
textwrap = { version = ">=0.15, <0.17", default-features = false, features = ["smawk", "unicode-width"] }
typenum = "1"
[build-dependencies]

View File

@ -42,6 +42,10 @@ fn options() -> textwrap::Options<'static> {
// textwrap do it, because textwrap uses an older version,
// leading to duplicate crates.
textwrap::Options::new(stderr_terminal_width())
// Using a more naive separation algorithm keeps URLs
// together, whereas the unicode line breaking algorithm would
// break after e.g. `hkps://`.
.word_separator(textwrap::WordSeparator::AsciiSpace)
}).clone()
}