Expand description
Reusable keyboard-interaction helpers for A2UI TUI applications.
The gallery app (a2ui::gallery::app) was the first place a complete,
validated event-dispatch pipeline was implemented. Several example programs
duplicate that ~40-line dispatch+apply boilerplate (and a couple carry bugs
where an EventResult is dropped). This module extracts the gallery’s
semantics into small public functions so any app can replace its hand-rolled
copy with a single call to handle_key (or the granular pieces).
The logic here mirrors gallery::app::GalleryApp’s
dispatch_event_to_focused / process_event_result methods exactly — it
does not introduce new behavior.
Functions§
- apply_
event_ result - Apply an
EventResultproduced by a component to the processor’s state. - dispatch_
to_ focused - Dispatch an already-built
InputEventto the focused component and return whateverEventResultit produces. - handle_
key - The one-call keyboard pipeline: map a
KeyCode, dispatch it to the focused component, and apply the resultingEventResult. - map_
key_ code - Map a crossterm
KeyCodeto the framework-agnosticInputKey.