aboutsummaryrefslogtreecommitdiff
path: root/docs/TUI-GUIDELINES.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/TUI-GUIDELINES.md')
-rw-r--r--docs/TUI-GUIDELINES.md13
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