Skip to main content

Module input_parser

Module input_parser 

Source
Expand description

Input parser state machine.

Decodes terminal input bytes into crate::event::Event values with DoS protection.

§Design

The parser is a state machine that handles:

  • ASCII characters and control codes
  • UTF-8 multi-byte sequences
  • CSI (Control Sequence Introducer) sequences
  • SS3 (Single Shift 3) sequences
  • OSC (Operating System Command) sequences
  • Bracketed paste mode
  • Mouse events (SGR protocol)
  • Focus events

§DoS Protection

The parser enforces length limits on all sequence types to prevent memory exhaustion:

  • CSI sequences: 256 bytes max
  • OSC sequences: 4KB max
  • Paste content: 1MB max

Structs§

InputParser
Terminal input parser with DoS protection.