Skip to main content

char_should_be_replaced

Function char_should_be_replaced 

Source
pub fn char_should_be_replaced(chr: char) -> bool
Expand description

Returns whether chr should be replaced/escaped when building a Snippet.

This identifies characters that are typically undesirable in rendered source snippets because they are control codes, invisible format characters, or can affect bidirectional text rendering.

Specifically, this returns true for:

  • C0 control characters (U+0000 to U+001F)
  • DEL (U+007F)
  • C1 control characters (U+0080 to U+009F)
  • ZERO WIDTH JOINER (U+200D)
  • Bidirectional controls (U+202A to U+202E, U+2066 to U+2069)