Expand description
Styled text utilities.
This module provides a small, generic representation of “styled spans” and helper functions for measuring and manipulating them in terms of terminal cell width.
Structs§
Functions§
- apply_
highlight - Apply highlighting to spans using grapheme-index ranges.
- clip_
to_ cells_ spans - Clip spans to at most
wcells. - clip_
to_ cells_ text - Clip a plain string to at most
wcells. - ellipsis_
to_ cells_ spans - Ellipsize spans to at most
wcells using the providedellipsis_span. - ellipsis_
to_ cells_ text - Ellipsize a plain string to at most
wcells using the providedellipsis. - measure_
cells_ spans - Measure spans in terminal cells using the provided glyph registry.
- measure_
cells_ text - Measure a plain string in terminal cells using the provided glyph registry.
- normalize_
spans - Normalize spans by:
- spans_
plain_ text - Returns the concatenated plain-text content of spans.
- wrap_
spans_ wordwise - Wrap spans word-wise into a sequence of visual lines.
Type Aliases§
- Spans
- A convenience alias for a sequence of styled spans.