pub fn take_prefix_by_width( text: &str, max_cols: usize, ) -> (String, &str, usize)
Take a prefix of text whose visible width is at most max_cols. Returns (prefix, suffix, prefix_width).
text
max_cols