From 6101b3a7a3dfd18039e117e0c38682e77f15a889 Mon Sep 17 00:00:00 2001 From: spx01 <42381535+spx01@users.noreply.github.com> Date: Thu, 21 Nov 2024 00:40:43 +0200 Subject: [PATCH] fix: simplify text reflowing strategy to improve language compatibility (#12048) --- helix-core/src/wrap.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helix-core/src/wrap.rs b/helix-core/src/wrap.rs index f32d6f4bc..337b389ae 100644 --- a/helix-core/src/wrap.rs +++ b/helix-core/src/wrap.rs @@ -4,6 +4,8 @@ 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 { - 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() }