aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-20 00:05:51 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-20 00:05:51 +0200
commita61cfeefb0599e74fc9189b189b16dd0b6d36f0f (patch)
tree83e0934e190744605e91e69cd032e91c85eecf57 /docs
parent1f2d7a8190876e3d1c541251e079a11a2cc637f2 (diff)
downloadbokf-a61cfeefb0599e74fc9189b189b16dd0b6d36f0f.tar.gz
bokf-a61cfeefb0599e74fc9189b189b16dd0b6d36f0f.zip
tui: remember the focused row in forms and the bokslut hubv0.1.44
Diffstat (limited to 'docs')
-rw-r--r--docs/STATE.md5
-rw-r--r--docs/TUI-GUIDELINES.md13
2 files changed, 16 insertions, 2 deletions
diff --git a/docs/STATE.md b/docs/STATE.md
index a108a52..d75f3cb 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -102,6 +102,11 @@ server/protocol/ledger only.
closed or already posted year). Årsredovisning and INK2/SRU left the
Rapporter menu, and Ingående balans moved from Bokföring to the
dashboard's Räkenskapsår section next to Räkenskapsår.
+ The form widgets remember focus across runs (`int *focus` as the last
+ argument to `tui_form_run*`: clamped to a selectable row on entry and
+ written back on every return; screens own a `static int sel`), so a
+ sub-screen round-trip or a field save returns the highlight to the
+ same row.
## Pending decisions
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