Skip to content

Commit

Permalink
don't break on hyphen with :reflow (helix-editor#8569)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen-Seo authored and danillos committed Nov 21, 2023
1 parent 42d21ea commit dd7d158
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion helix-core/src/wrap.rs
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit dd7d158

Please sign in to comment.