visible_len
The number of characters a terminal shows for text: its length once escape sequences are
removed.
Use it to pad or truncate styled text to a column width. It counts chars, not display cells,
so wide characters (CJK, some emoji) count as one and combining marks count too; use a
width-aware crate when you need exact terminal columns.
Import
Section titled “Import”Cargo feature ansi (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
text | &str | The text, possibly containing escape sequences. |
Returns
Section titled “Returns”usize — The number of visible characters.
