diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-20 00:05:51 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-20 00:05:51 +0200 |
| commit | a61cfeefb0599e74fc9189b189b16dd0b6d36f0f (patch) | |
| tree | 83e0934e190744605e91e69cd032e91c85eecf57 /docs/TUI-GUIDELINES.md | |
| parent | 1f2d7a8190876e3d1c541251e079a11a2cc637f2 (diff) | |
| download | bokf-a61cfeefb0599e74fc9189b189b16dd0b6d36f0f.tar.gz bokf-a61cfeefb0599e74fc9189b189b16dd0b6d36f0f.zip | |
tui: remember the focused row in forms and the bokslut hubv0.1.44
Diffstat (limited to 'docs/TUI-GUIDELINES.md')
| -rw-r--r-- | docs/TUI-GUIDELINES.md | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/TUI-GUIDELINES.md b/docs/TUI-GUIDELINES.md index 3bed983..3bd3c65 100644 --- a/docs/TUI-GUIDELINES.md +++ b/docs/TUI-GUIDELINES.md @@ -65,6 +65,14 @@ written compactly as `^N`, `^A`, `^C`, `^R` to save width. - Field navigation: `Tab` / `Shift-Tab` forward/back, arrows Up/Down between rows. `Enter` advances in simple forms; it never saves unless the screen is a one-line prompt. +- Focus memory: the screen keeps the focused row in an `int` and passes its + address as the last argument to `tui_form_run`, `tui_form_run_hook` and + `tui_form_run_actions` (like a list cursor). On entry `*focus` is clamped + to a selectable row — out of range snaps to the nearest end, a heading row + snaps forward and wraps — and on every return (`Esc`, `F5`, `^Enter`, a + chosen action, an edited field) the row is written back, so a re-run after + a save or a round-trip through another screen lands on the same row. + `NULL` starts at the first focusable row and stores nothing. - The active field is drawn reverse-video and holds the hardware cursor at the caret. The caret is a real position: ←/→/Home/End/Del work inside the field, `Ctrl+U` clears it (see `field_edit`). @@ -104,8 +112,9 @@ written compactly as `^N`, `^A`, `^C`, `^R` to save width. `label (reason)`, `Enter` shows the reason in a message; `-1` is a dim non-selectable heading/status row like a menu section. The call returns the field index after an edit, `TUI_FORM_ACTION + i` for a chosen action, - or `TUI_FORM_BACK`/`REFRESH`/`SUBMIT`; `tui_form_hint()` overrides the - footer of the next run as usual. + or `TUI_FORM_BACK`/`REFRESH`/`SUBMIT`, and stores the row it stopped on in + the `int *focus` argument (see focus memory above); `tui_form_hint()` + overrides the footer of the next run as usual. - `Bokslut` is the year-end hub in one view: the year fields, the status heading `Bokslut bokfört: ja/nej` (derived from the `Skatt på årets resultat` voucher that `bokslut.post` creates; a closed year counts as |
