pub fn truncate(line: &str, width: usize) -> StringExpand description
Shortens line to at most width visible columns, ending it with … when something was cut.
Styles that are open at the cut are closed. A line that fits is returned unchanged.
use shellgame::ui::text::truncate;
assert_eq!(truncate("abcdefgh", 5), "abcd…");
assert_eq!(truncate("abc", 5), "abc");