summaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorStephen Seo2023-10-21 12:58:36 +0000
committerGitHub2023-10-21 12:58:36 +0000
commit31f50bf5bf0d49af7359533e0865e878184c5225 (patch)
treeccd602f03deae8666ec49bc49b0fe051f45263ce /helix-core/src
parent764715a6c069754b852ed9e8d98aaf7efd88abe6 (diff)
don't break on hyphen with :reflow (#8569)
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/wrap.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-core/src/wrap.rs b/helix-core/src/wrap.rs
index 2ba8d173..f32d6f4b 100644
--- a/helix-core/src/wrap.rs
+++ b/helix-core/src/wrap.rs
@@ -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()
}