Skip to main content

Module tui

Module tui 

Source
Expand description

The terminal UI (spec §10): a live dashboard and action center.

The state and pure event handling live in app and event; the views in view/glyphs/theme; and the terminal runtime (raw mode, the event loop, async loading) in terminal/runtime.

Re-exports§

pub use app::App;
pub use app::Mode;
pub use app::Pane;
pub use event::Effect;
pub use options::OptionList;
pub use runtime::ComposeSeed;
pub use runtime::run_pr_picker;
pub use runtime::run_tui;

Modules§

app
TUI view-model: the App state and the modal substates (spec §10).
event
Pure event handling for the TUI (spec §10). App::handle_event maps a terminal event to a state mutation and an Effect for the runtime to execute (switch, create, remove, refresh, …). No terminal I/O happens here, which is what makes the whole interaction testable.
glyphs
Status/marker glyphs for the TUI (spec §10 Nerd Font support). The ASCII fallbacks (the default) match the wt list markers; Nerd Font glyphs are an optional, purely cosmetic alternative.
hints
Single source of truth for the modal status-bar / overlay key hints (issue #39). Each modal mode declares its keys exactly once here; view renders both the bottom status bar and the in-overlay hint rows from these tables, and the consistency test below drives every hinted key through the real handler — so a hint can never claim a key the handler ignores, nor drift from it during a refactor.
options
A reusable inline option list (the “dropdown” of selectable values shown on a pop-up field, issue #25).
runtime
TUI runtime (spec §10): the async event loop that drives App, executes Effects, and loads async data. The loop and terminal handling are the thin, untestable shell; the effect-executing helpers are pure of the terminal and are unit-tested. Shell-based mutating actions run on a background task as a Job and apply their JobOutcome to the app, so the loop can animate a spinner overlay instead of freezing (issue #46).
terminal
Terminal lifecycle for the TUI (spec §10): raw mode + alternate screen on stderr (stdout stays reserved for the chosen path, §5), a panic hook that restores the terminal, and suspend/resume for the foreground editor.
theme
Truecolor theme for the TUI (spec §10/§11): maps worktree and UI state to ratatui Styles.
view
TUI rendering (spec §10): the list pane, detail pane, status bar, and modal overlays. Rendering is a pure function of App state into a ratatui Frame, so it is testable with a TestBackend. Color comes from the resolved Theme (spec §11); when color is disabled the styles collapse to the monochrome look (dim/bold/reversed only).