pub fn strip_vt_sequences(text: &str) -> StringExpand description
Strip VT/ANSI escape sequences from text before PTY injection.
Removes CSI (ESC[), OSC (ESC]), DCS (ESC P), APC (ESC _),
PM (ESC ^), SOS (ESC X) sequences, and bare two-byte ESC x
sequences. Printable characters and newlines are passed through.
This is required for safe WriteText dispatch: a script must not be
able to embed control sequences that reposition the cursor, exfiltrate
data, or otherwise corrupt the terminal state.