Skip to main content

wrap_lines

Function wrap_lines 

Source
pub fn wrap_lines(text: &str, content_width: usize) -> Vec<String>
Expand description

Word-wrap text so each line fits within content_width columns.

Returns a Vec<String> where the first element is the first line of text and subsequent elements are continuation lines. Words are split on whitespace; a word longer than the content width is kept on its own line unbroken (e.g. URLs).

This function operates on the raw text — callers apply the box-drawing prefix and styling to each returned line.