pub fn wrap_optimal(text: &str, width: usize) -> KpBreakResultExpand description
Compute optimal line breaks using Knuth-Plass DP.
Given a paragraph of text and a target width, finds the set of line breaks that minimizes total badness (cubic slack penalty).
Falls back to greedy word-wrap if the DP cost is prohibitive (very
long paragraphs), controlled by max_words.
§Arguments
text- The paragraph to wrap (no embedded newlines expected).width- Target line width in cells.
§Returns
KpBreakResult with optimal lines, total cost, and per-line badness.