Expand description
Unicode character cell width calculations.
This module provides functions to calculate the display width of text in terminal cells, handling wide characters (CJK, emoji) correctly.
Functionsยง
- cell_
len - Get the total cell width of a string (cached for longer strings).
- cell_
len_ uncached - Get the total cell width of a string without caching.
- cell_
positions - Get the cell position for each character in a string.
- cell_
to_ byte_ index - Find the byte index for a given cell position.
- chop_
cells - Split a string at a cell position.
- get_
character_ cell_ size - Get the cell width of a single character.
- has_
wide_ chars - Check if a string contains any wide (2-cell) characters.
- set_
cell_ size - Truncate a string to fit within a maximum cell width.