fix: simplify text reflowing strategy to improve language compatibility (#12048)

pull/11066/merge
spx01 19 hours ago committed by GitHub
parent 887bbbc375
commit 6101b3a7a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,6 +4,8 @@ use textwrap::{Options, WordSplitter::NoHyphenation};
/// Given a slice of text, return the text re-wrapped to fit it /// Given a slice of text, return the text re-wrapped to fit it
/// within the given width. /// within the given width.
pub fn reflow_hard_wrap(text: &str, text_width: usize) -> SmartString<LazyCompact> { pub fn reflow_hard_wrap(text: &str, text_width: usize) -> SmartString<LazyCompact> {
let options = Options::new(text_width).word_splitter(NoHyphenation); let options = Options::new(text_width)
.word_splitter(NoHyphenation)
.word_separator(textwrap::WordSeparator::AsciiSpace);
textwrap::refill(text, options).into() textwrap::refill(text, options).into()
} }

Loading…
Cancel
Save