vxml_pipeline/line_wrapping

Blame-preserving word wrapping for VXML text lines.

This module measures Gleam string length, not terminal display width. It treats spaces as token separators and does not split an individual token that exceeds the requested width.

Values

pub fn rewrap_lines(
  lines: List(vxml.Line),
  occupied_width_before_text: Int,
  max_line_width: Int,
) -> #(List(vxml.Line), Int)

Rewraps text lines to fit within max_line_width.

occupied_width_before_text reserves width on the first output line; later lines begin at column zero. The returned integer is the occupied width at the end of the final output line. Each new line receives the blame of its first token.

Empty first and last input lines are not preserved as protected boundaries; their spacing can be absorbed into neighboring content.

Search Document