Expand description
Measuring text in terminal cells: width, truncation with an ellipsis at the end or in the middle, and word wrapping.
Constants§
- ASCII_
ELLIPSIS - The mark that stands for
ELLIPSISin ASCII glyph mode. - ELLIPSIS
- The ellipsis drawn where text is cut.
Functions§
- grapheme_
width - Display width of one grapheme cluster.
- printable
- One line written for a terminal, as the terminal would leave it on screen: what a carriage return wrote over is gone, colour and cursor sequences are taken out, a tab becomes spaces up to the next stop of eight and no other control character is left.
- truncate
textcut to at mostmaxcells, ending in…when anything was removed.- truncate_
middle textcut to at mostmaxcells by removing its middle, with…where the middle was.- width
- Display width of
textin cells. - wrap
- Splits
textinto lines no wider thanmaxcells. - wrap_
ranges - Like
wrap, but returns byte ranges intotext, so styled text can be wrapped and drawn with its styles.