Skip to main content

Crate cui

Crate cui 

Source
Expand description

cui — TUI browser for cuj vaults.

Evernote-shaped, keyboard-only: a jot list on the left, the selected jot (metadata strip + highlighted content) on the right, global commands in the top bar, context commands below it, and an ex-style ‘:’ command line at the bottom. Browsing commits nothing and never reindexes an extension chain; the one write path is e, which hands the selected jot to $EDITOR via the cuj library’s edit flow.

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

cmdline
The ‘:’ command line: a minimal insert-at-cursor editor plus the ex-command parser.
error
cui-level error conditions: thin wrappers over the cuj library errors, mapped to the same stable exit codes (cuj SPEC §10.3).
highlight
Jot Syntax highlighting for the content pane. The jots parser is the authority on which constructs exist (cuj SPEC §2.1 delegates rendering to the Jot Syntax implementation): construct spans come from the parser’s byte-offset loc fields, and tag / category occurrences — which carry no locs in the parser output — are located by scanning the text for the parsed names. Raw text is never rewritten; only styling is added.
keymap
The keyboard command system: one static binding table drives both dispatch (lookup) and the command bars (bar_items), so a binding shown in a bar is by construction the binding that fires.
query
Index-backed queries (cuj SPEC §9.5, §9.7, §9.17), returning owned data and never printing. Unlike the CLI, cui never reindexes: chains are opened read-only and queried at their pinned state; staleness is reported to the caller instead of blocking on a rebuild (or eprintln!-ing over the alternate screen).
snapshot
The owned read model: everything the UI needs, copied out of a transient cuj::reads::Reads (cuj SPEC §8.1) so no borrow of the vault outlives the build. Content blobs are not part of the snapshot — they are fetched lazily and cached by the app state.
state
Application state and the command reducer. The reducer is pure state manipulation (it may read the vault and run index queries) and never touches the terminal, so every transition is testable headless.
ui
Drawing: pure functions from &AppState to the frame. The only state the draw pass writes back is the measured viewport heights, which the reducer needs for paging.

Functions§

run
The event loop: blocking reads (the browser has no background activity), one redraw per event.