Terminal display width that gets emoji, CJK and ANSI colour right. Measure, truncate, pad and wrap text so columns actually line up. No dependencies, no_std.
//! Dev tool: print `cp<TAB>width` for every code point, for cross-checking
//! against another implementation. Not part of the library.
fnmain(){letmut out =String::new();for cp in0u32..=0x10FFFF{ifletSome(c)=char::from_u32(cp){
out.push_str(&format!("{cp}\t{}\n",cellwidth::char_width(c)));}}print!("{out}");}