Skip to main content

Module fit

Module fit 

Source
Expand description

§Fit Output to the Pane

Breaks output lines that are wider than the output pane. A broken line continues on the next row after the gutter of its first row (leading spaces and │ bars), so text inside a section stays inside it. A rule (a line that ends in a long ─ run) is cut at the pane edge instead.

Widths are measured per grapheme cluster, as ratatui draws them: ⚠️ (with its variation selector) is two columns, and an emoji ZWJ sequence is one cluster. A cluster is never split across rows. Tabs become spaces to the next tab stop first, because ratatui does not draw them. Styles of the spans are kept.

Functions§

fit
Fits lines to width columns. Lines that fit are kept as they are (with tabs expanded).