Skip to main content

is_safe

Function is_safe 

Source
pub fn is_safe(data: &str) -> bool
Expand description

Check if paste data is safe to paste into the terminal.

Data is considered unsafe if it contains:

  • Newlines (\n) which can inject commands
  • The bracketed paste end sequence (\x1b[201~) which can be used to exit bracketed paste mode and inject commands

This check is conservative and considers data unsafe regardless of current terminal state.