Expand description
improv-tui: a VisiCalc-style pivot grid over an Improv model.
Usage: improv-tui <model.db | postgres://β¦?model=NAME>
The binary is a thin shell: run owns the real terminal (raw mode, alt
screen, panic hook) and feeds crossterm events into event_loop, which
is generic over the ratatui backend and the event source so tests can drive
it with a TestBackend and a scripted Vec<Event>.
ModulesΒ§
- app π
- App state and the pure pivot-grid logic (terminal-free, unit-tested).
- complete π
- Formula-edit assistance, terminal-free: Tab completion of the identifier before the caret, and the ghost text of the parameters still to type.
- diagnose π
- Located formula errors, terminal-free: the span of text a
[
ParseError] is about, its message, and a hint for the common cases (a misspelled name, the wrong number of arguments, an unclosed(). - edit π
- The edit line for a cell value or a formula: its text and a caret.
- fnhelp π
- Function help overlay state (
?/ F1): a search line over the built-in functions, the ranked results, and the selection in them. Pure state, terminal-free;uidraws it andmainfeeds it keys. - ui π
- Rendering: a status box (title, prompt/message, pages, filters, key help) sized to its content, over the pivot grid as a table.
FunctionsΒ§
- event_
loop π - Draw, then handle one event, until the app quits or
eventsruns dry. - filter_
row_ πunder_ cursor - Toggle the visibility of the row item under the cursor within its (row) category. Repeated βfβ on different rows narrows the row axis to a subset.
- handle_
event π - Dispatch one terminal event by mode (edit / command prompt / normal).
- help_
key π - Keys while the function help overlay is open: type to search, move the
selection, Enter inserts
NAME(into an edit in progress, Esc closes. - line_
key π - Line-editing keys for the command prompt (the cell edit has a caret:
edit::LineEdit::key). - load π
- Open the model at
pathand build the app state. - main π
- normal_
key π - Key handling in normal (navigation) mode.
- restore π
- Undo terminal setup. Safe to call multiple times.
- revert π
- Reload the model from
path, dropping this sessionβs unsaved edits. The way out of a save conflict: the quit autosave refuses to clobber another writer, so revert, pick up their changes, and redo yours. On failure the session is untouched. - run π
- Enter the alt screen, run the loop, and always restore the terminal β even on error or panic β then autosave.
- save π
- Autosave the (possibly edited) model back to
pathon clean exit; edits are held in memory during the session. - save_
current_ πview - Save the current layout as a generated βview Nβ name and persist to
path. (Inline text entry is intentionally omitted; the view can be renamed via a future dialog. Documented simplification.)