pub fn sanitise(text: &str, max_chars: usize) -> StringExpand description
Text as an event may carry it: no control character, no terminal escape sequence, and bounded.
Every line a handler or a child process produces goes through here. A browser is not
the only reason — a terminal reading majordomus run --follow would be repainted by an
escape it did not choose — and doing it once, here, is why no consumer has to.
use majordomus_cli::execution::event::sanitise;
assert_eq!(sanitise("plain", 100), "plain");
assert_eq!(sanitise("\u{1b}[31mred\u{1b}[0m", 100), "red");
assert_eq!(sanitise("a\u{0}b\tc", 100), "a b\tc");
assert_eq!(sanitise("abcdef", 4), "abc…");