Skip to main content

Module sanitize

Module sanitize 

Source
Expand description

Keeping untrusted text (cells, column names, filenames, parser errors) from becoming terminal commands: \x1b]52;c;...\x07 in a cell writes the clipboard, \x1b[2J wipes the screen. ratatui’s Buffer::set_stringn drops control graphemes, but Span and Line rendering append zero-width graphemes (ESC included) to the previous cell, and crossterm prints cells unfiltered. Rather than guard every Span site, one sweep runs at the end of App::render over the finished buffer.

Functions§

sanitize_buffer
Replace control characters in every cell of a finished buffer: once, after all rendering, before the backend, the last point datui controls the output.
sanitized
A display-safe copy of s, or None if already safe (the usual case, sparing an allocation).