TermUI.Terminal.EscapeParser (TermUI v0.2.0)
View SourceParses terminal escape sequences into Event structs.
Handles CSI sequences (ESC[...), SS3 sequences (ESCO...), and control characters. Returns parsed events and any remaining unparsed bytes.
Supported Sequences
- Arrow keys: ESC[A/B/C/D
- Function keys: F1-F12 (both SS3 and CSI variants)
- Home/End/Insert/Delete/PageUp/PageDown
- Ctrl+key: 0x01-0x1A
- Alt+key: ESC followed by key
- Regular printable characters
Summary
Functions
Parses input bytes into a list of events and remaining bytes.
Checks if the given bytes might be a partial escape sequence.
Functions
@spec parse(binary()) :: {[TermUI.Event.Key.t()], binary()}
Parses input bytes into a list of events and remaining bytes.
Returns {events, remaining} where events is a list of Event.Key structs
and remaining is bytes that couldn't be parsed yet (partial sequences).
Checks if the given bytes might be a partial escape sequence.
Used to determine if we should wait for more input or emit a lone ESC.