Skip to main content

strip_controls

Function strip_controls 

Source
pub fn strip_controls(s: &str) -> String
Expand description

A text without control characters: ANSI escape sequences dropped whole, every other control character but the newline dropped.

A diagnostic captured from a terminal can carry colour codes; every surface renders record text, and not all of them escape it, so none of it reaches a record.

use majordomus_cli::reasoning::store::strip_controls;

assert_eq!(strip_controls("\u{1b}[31mred\u{1b}[0m\tdone\nnext"), "reddone\nnext");