Skip to main content

display_width

Function display_width 

Source
pub fn display_width(s: &str) -> usize
Expand description

Display width of s in terminal columns.

Columns, not bytes and not chars: bytes mis-measure every non-ASCII line, and chars mis-measure CJK (2 columns) and combining marks (0). The renderer already measures this way, so a reflowed line lands where the user was told it would.