Skip to main content

sanitize

Function sanitize 

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

Replace control characters with spaces.

Captions arrive from anywhere: the CLI reads them off a pipe, so make 2>&1 | inkling puts another program’s output on the caption line. A control character costs no display columns but can move the cursor or repaint the screen, which would let that output steer the terminal it was only meant to label. Neutralize them at the door rather than at every write.