Skip to main content

Module layout

Module layout 

Source
Expand description

Width-aware layout helpers for the row model.

These functions operate on the renderer’s own Span and CellStyle types. They are the single source of truth for wrapping, padding, and truncation so that cursor placement and snapshots stay deterministic.

Functions§

content_width
Maximum width usable for body content inside a padded block.
pad_left
Left-pad a row’s spans with count cells using pad_style.
pad_right
Right-pad a row’s spans with count cells using pad_style.
pad_row
Pad a row on both sides to reach exactly width columns.
spans_width
Width (column count) of a span slice.
truncate_spans
Truncate spans to width columns, appending if anything was cut.
wrap_spans
Wrap styled spans into rows no wider than width, preserving explicit \n newlines inside span text.
wrap_text
Word-wrap plain text into rows no wider than width.
wrap_text_preserving_whitespace
Wrap plain text without normalizing whitespace.