Skip to main content

Module state

Module state 

Source
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§

HistorySearchState
Cross-session prompt-history search state (Ctrl+R), live while TuiState::input_focus is InputFocus::HistorySearch.
StatusLine
The status line’s contents — deliberately minimal (a renderer decorates this, doesn’t reinterpret it).
TranscriptEntry
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_key and the input to TuiState::apply. Not Clone/PartialEq-derived as a whole: the Show*Modal variants embed a one-shot reply channel (std::sync::mpsc::Sender/ tokio::sync::oneshot::Sender, neither of which is PartialEq) — tests assert on the resulting TuiState, not on raw Action equality.
InputFocus
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_enabled is true — see that field’s doc comment for the deliberately-basic scope: hjkl motion, i/a/o mode entry, x/dd deletion. 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-level tui module doc comment’s “shippable vs staged” note.