Skip to main content

Module text

Module text 

Source
Expand description

Measuring text in terminal cells: width, truncation with an ellipsis, and word wrapping.

Constants§

ELLIPSIS
The ellipsis drawn where text is cut.

Functions§

grapheme_width
Display width of one grapheme cluster.
truncate
text cut to at most max cells, ending in when anything was removed.
width
Display width of text in cells.
wrap
Splits text into lines no wider than max cells.
wrap_ranges
Like wrap, but returns byte ranges into text, so styled text can be wrapped and drawn with its styles.