pub fn wrap(s: &str, width: usize) -> Vec<String>Expand description
Wraps text to fit within a maximum display width, breaking at word boundaries.
Returns a vector of lines, each fitting within the specified width. Words longer than the width are force-broken to fit.
ANSI escape codes are preserved and don’t count toward width calculations.
§Arguments
s- The string to wrapwidth- Maximum display width for each line
§Example
use standout_render::tabular::wrap;
let lines = wrap("hello world foo", 11);
assert_eq!(lines, vec!["hello world", "foo"]);
let lines = wrap("short", 20);
assert_eq!(lines, vec!["short"]);
// Long words are force-broken with ellipsis markers
let lines = wrap("supercalifragilistic", 10);
assert!(lines.len() >= 2);
for line in &lines {
assert!(standout_render::tabular::display_width(line) <= 10);
}