Skip to main content

wrap_spans

Function wrap_spans 

Source
pub fn wrap_spans(spans: &[Span], width: usize) -> Vec<Vec<Span>>
Expand description

Wrap styled spans into rows no wider than width, preserving explicit \n newlines inside span text.

Spans are split at character boundaries; adjacent spans keep their individual styles. A single logical row can contain multiple spans. Blank (empty-text) input produces a single empty row so callers always get at least one row.