Skip to main content

char_width

Function char_width 

Source
pub fn char_width(c: char) -> usize
Expand description

The width of one character in terminal columns: zero for a combining mark, two for the wide and fullwidth blocks, one otherwise.

An approximation of Unicode’s East Asian Width, held to the ranges that actually reach a repository’s metadata: the CJK and Hangul blocks, the fullwidth forms, and the emoji that terminals draw double. It is deliberately a table here rather than a dependency — the alternative is a crate with its own Unicode database for the sake of drawing a box.