pub fn truncate_with(value: &str, columns: usize, ellipsis: &str) -> StringExpand description
truncate, with the mark that says something was removed given explicitly. A
terminal that cannot render … gets ..., and the width arithmetic follows the mark
it was actually given rather than assuming one column.
use majordomus_cli::environment::text::{truncate_with, width};
assert_eq!(truncate_with("majordomus", 6, "..."), "maj...");
assert_eq!(width(&truncate_with("majordomus", 6, "...")), 6);
assert_eq!(truncate_with("majordomus", 2, "..."), "ma", "no room for the mark");