Expand description
P5-4 (§2 module 30): the TESTABLE view-model core — a pure handle_key
(keypress → intended Actions) plus apply (mutate TuiState for
ANY action, whether it came from a keypress or from an interactive
handler’s request landing on the bridge channels — see
crate::tui::handlers). Neither function touches a terminal; every
test in this module drives the whole thing by hand.
Structs§
- History
Search State - Cross-session prompt-history search state (Ctrl+R), live while
TuiState::input_focusisInputFocus::HistorySearch. - Status
Line - The status line’s contents — deliberately minimal (a renderer decorates this, doesn’t reinterpret it).
- Transcript
Entry - One line (or block) in the scrollback transcript.
- TuiState
- The whole TUI view-model — see the module doc comment. Constructed
fresh per TUI session by the CLI render layer; every mutation goes
through
Self::apply.
Enums§
- Action
- A pure description of a state transition — the output of
TuiState::handle_keyand the input toTuiState::apply. NotClone/PartialEq-derived as a whole: theShow*Modalvariants embed a one-shot reply channel (std::sync::mpsc::Sender/tokio::sync::oneshot::Sender, neither of which isPartialEq) — tests assert on the resultingTuiState, not on rawActionequality. - Input
Focus - What the input composer is showing right now.
- Modal
- An interactive modal covering the composer — at most one at a time
(§2.28: approval / elicitation / child-approval / OAuth-code-display).
A later request queues behind the earlier one still on screen (see
TuiState::modal_queue) rather than clobbering it. - Role
- Who said one transcript line.
- VimMode
- Vim-emulation sub-mode (only consulted when
TuiState::vim_enabledistrue— see that field’s doc comment for the deliberately-basic scope:hjklmotion,i/a/omode entry,x/dddeletion. This is NOT a full vim emulation (no registers, no visual mode, no.-repeat, no counts) — a shippable-complete BASIC modal editor, with full vim cited as a follow-up rather than half-built. See the crate-leveltuimodule doc comment’s “shippable vs staged” note.