Skip to main content

sanitize_paste_content

Function sanitize_paste_content 

Source
pub fn sanitize_paste_content(input: &str) -> String
Expand description

Sanitize clipboard paste content by stripping dangerous control characters.

Removes characters that could inject terminal escape sequences when pasted:

  • C0 control characters (0x00-0x1F) except Tab (0x09), Newline (0x0A), and Carriage Return (0x0D) which are safe/expected in paste content
  • ESC (0x1B) is explicitly stripped to prevent escape sequence injection
  • C1 control characters (0x80-0x9F) including CSI (0x9B)

All normal printable ASCII, extended Latin, and Unicode text passes through unchanged.