From ae60b7d2c87cc9ed6878faa57cd4233f77f6f7c3 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Sun, 20 Sep 2026 10:24:18 +0200 Subject: tui: pinned report headers, voucher detail headers, clamped paging --- clients/tui.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'clients/tui.h') diff --git a/clients/tui.h b/clients/tui.h index fcab5b7..6df27fb 100644 --- a/clients/tui.h +++ b/clients/tui.h @@ -37,13 +37,20 @@ void tui_style(enum tui_style s); void tui_style_reset(void); /* Pager line markup. A leading marker selects a style; \x03 is a rule and - is drawn full width as ACS_HLINE. tui_markup returns the text after the - marker and sets *style to the matching style, or -1 for plain text. */ + is drawn full width as ACS_HLINE; \x04 pins the line as a column header + above the scrolling body. tui_markup returns the text after the marker(s) + and sets *style to the matching style, or -1 for plain text. */ #define TUI_MARK_HEADING 0x01 #define TUI_MARK_DIM 0x02 #define TUI_MARK_RULE 0x03 +#define TUI_MARK_STICKY 0x04 const char *tui_markup(const char *line, int *style); +/* Moves sticky-marked lines from lines[] to head[] (both in input order), + compacts the remaining body lines in lines[] and returns the body count. + head must hold at least n pointers and must not alias lines. Pure. */ +int tui_sticky_split(char **lines, int n, char **head, int *nhead); + /* Key hooks: widgets call the screen's hook for keys they do not handle. */ #define TUI_HOOK_NONE 0 /* not handled: process the key normally */ #define TUI_HOOK_STAY 1 /* handled: redraw and keep the widget up */ @@ -213,6 +220,10 @@ int tui_form_focus_store(int *focus, int sel, int ret); are skipped and the ring wraps. dir +1 = Tab/Down, -1 = Shift-Tab/Up. */ int tui_form_act_step(int focus, int nf, const struct tui_form_action *acts, int na, int dir); +/* Like tui_form_act_step, but pages (up to TUI_FORM_PAGE rows) and stops at + the first/last selectable row instead of wrapping. dir +1 = PgDn. */ +int tui_form_act_page(int focus, int nf, const struct tui_form_action *acts, + int na, int dir); /* Same ring for one key, plus Home/End/PgUp/PgDn and the form return keys (F5/^Enter/F9/Esc/q). Returns the new focus, a TUI_FORM_* code or TUI_NAV_NONE. */ -- cgit v1.3