From e352cd34d30acc1955c62027c779ac98004ac201 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Sat, 19 Sep 2026 22:33:33 +0200 Subject: tui: migrate the remaining screens to the widget layer --- docs/TUI-GUIDELINES.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'docs/TUI-GUIDELINES.md') diff --git a/docs/TUI-GUIDELINES.md b/docs/TUI-GUIDELINES.md index 63c492f..276cfd9 100644 --- a/docs/TUI-GUIDELINES.md +++ b/docs/TUI-GUIDELINES.md @@ -72,11 +72,24 @@ written compactly as `^N`, `^A`, `^C`, `^R` to save width. - Derived values (account names, balances) are dim and non-editable. - Row tables: always exactly one empty trailing row; entering data appends a new empty row; an empty row followed by another empty row collapses. - `Ctrl+X` clears the selected row. + `Ctrl+X` clears the selected row. `Tab` walks the editable cells and wraps + to the next row's first cell (`Shift-Tab` back). A dim footer callback may + show derived lines (balance, attachment list) directly under the table. +- Fields with `mask` set are shown as `*` (`tui_form_field.mask`); used for + passwords. ACTION fields show their `value` when set, else `(lista)`. +- Header fields plus rows: the header is a `tui_form_run`, the rows a + `tui_rt_run`. Editing a header field hands over to the row table; `Esc` in + the table goes back to the header. `F5`/`Ctrl+Enter` work in both stages. - Validation: `F5` validates without writing and reports exactly what is wrong (field, row number). Server `dry_run` is used where available. - Saving: `Ctrl+Enter` writes, shows a confirmation message, and returns to the previous view. `Esc` cancels without saving. +- Screen-specific keys (template picker, attach, link, download) are handled + in a key hook, never with a local loop. The hook runs for keys the widget + itself does not handle and returns `TUI_HOOK_*`: `STAY` (consumed, redraw), + `BACK`, `REFRESH` or `SUBMIT` (the widget returns as on `Esc`/`F5`/ + `Ctrl+Enter`). Hooks exist on `tui_form_run_hook`, `tui_rt_set_key`, + `tui_pager_hook` and `tui_select_list_hook`. - File browser (`file_browser`): starts in the org's `attachment_dir` (or `$HOME`; a leading `~` is expanded to `$HOME`), `.. (uppåt)` is the first row, directories sort first with a trailing `/`, hidden files are skipped. Enter enters a directory or picks a @@ -118,7 +131,13 @@ only place that touches ncurses. Rules: is separated from drawing so it can be tested without a terminal. - Widgets return key codes (`-1` back, `-2` refresh, `-4` new, `-6` remove, `-7` toggle) and write text into the caller's buffer; nothing returns - static storage. + static storage. `TUI_NAV_NONE`, `TUI_FORM_BACK/REFRESH/SUBMIT` and the + `TUI_HOOK_*` codes are all distinct. +- `tui_pager_hook` takes `TUI_PAGER_SAVE` to enable the `s` save action; the + `extra_hint` is shown in the footer. Plain `tui_pager` keeps `s` on when a + save hint is passed. +- `tui_redraw` flushes a `tui_frame`/`tui_set_status` pair drawn by the + application outside a widget loop (startup/reconnect messages). - The application supplies input, frame/hints and quit through `tui_set_input`/`tui_set_screen`/`tui_set_quit`. -- cgit v1.3