aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/wrap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src/wrap.rs')
-rw-r--r--helix-core/src/wrap.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-core/src/wrap.rs b/helix-core/src/wrap.rs
new file mode 100644
index 00000000..eabc47d4
--- /dev/null
+++ b/helix-core/src/wrap.rs
@@ -0,0 +1,7 @@
+use smartstring::{LazyCompact, SmartString};
+
+/// Given a slice of text, return the text re-wrapped to fit it
+/// within the given width.
+pub fn reflow_hard_wrap(text: &str, max_line_len: usize) -> SmartString<LazyCompact> {
+ textwrap::refill(text, max_line_len).into()
+}