Parses raw terminal input bytes into structured key and mouse events.
Handles:
- Regular characters (UTF-8)
- Control keys (Ctrl+A through Ctrl+Z)
- Escape sequences (arrows, function keys, home/end, etc.)
- SGR mouse events (\e[<...M/m)
- Bracketed paste (\e[200~ ... \e[201~)
- Kitty keyboard protocol CSI u sequences (\e[codepoint;modifier:event_type u)
- xterm modifyOtherKeys (\e[27;modifier;keycode~)
- Capability query responses (\e[?{flags}u)
Summary
Functions
Parse a chunk of raw terminal input into a list of events.
Types
@type event() :: key_event() | mouse_event() | paste_event() | capability_event()
@type mouse_event() :: %{ type: :mouse, action: :press | :release | :move | :scroll_up | :scroll_down, button: :left | :right | :middle | :none, x: non_neg_integer(), y: non_neg_integer(), ctrl: boolean(), alt: boolean(), shift: boolean() }
@type paste_event() :: %{type: :paste, data: String.t()}