Skip to main content

strip_terminal_codes

Function strip_terminal_codes 

Source
pub fn strip_terminal_codes(line: &str) -> TerminalLine
Expand description

Remove terminal escape sequences from line. Two families matter here:

  • CSI — ESC [ … <final 0x40..=0x7e> (colors, cursor moves)
  • OSC — ESC ] … (BEL | ST) — an OSC-8 hyperlink embeds the URL in the sequence params AND repeats it as visible link text. A naive pass that only knew CSI left the raw ]8;;https://…<BEL> in place and captured the URL twice (doubled) whenever OSC-8 IS present, so the OSC sequence is discarded but any URI it carried is kept in link_uris.