Expand description
How many terminal columns a glyph occupies.
Every renderer measures cells through this one function, so a hidden cell reserves exactly as many columns as the glyph will need once it appears. That is what keeps a row from shifting sideways as the reveal crosses a wide glyph.
Functionsยง
- glyph_
cols - Display columns a glyph occupies:
0for zero-width and combining marks,2for wide glyphs (CJK and many emoji),1otherwise. - sanitize
- Replace control characters with spaces.
- str_
cols - Total display columns of a string.
- truncate_
to_ cols - Truncate
sto at mostmaxdisplay columns, dropping whole glyphs so a wide glyph is never split across the edge.