mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-08-17 12:00:22 +03:00
don't break on hyphen with :reflow (#8569)
This commit is contained in:
parent
764715a6c0
commit
31f50bf5bf
@ -1,7 +1,9 @@
|
||||
use smartstring::{LazyCompact, SmartString};
|
||||
use textwrap::{Options, WordSplitter::NoHyphenation};
|
||||
|
||||
/// Given a slice of text, return the text re-wrapped to fit it
|
||||
/// within the given width.
|
||||
pub fn reflow_hard_wrap(text: &str, text_width: usize) -> SmartString<LazyCompact> {
|
||||
textwrap::refill(text, text_width).into()
|
||||
let options = Options::new(text_width).word_splitter(NoHyphenation);
|
||||
textwrap::refill(text, options).into()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user