pub fn truncate_middle(text: &str, max_len: usize) -> StringExpand description
Truncate text to at most max_len chars, keeping a head and a tail joined by
a single … so context from both ends is preserved.
Control characters are replaced with spaces before truncation so the result is safe to render in a terminal/TUI. When the text already fits it is returned unchanged (after sanitization).
This is the canonical middle-truncation helper, shared so the same logic is not re-implemented per crate.