aboutsummaryrefslogtreecommitdiffstats
path: root/src/vega.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 11:33:31 +0100
committereunhhu <[email protected]>2026-09-26 11:33:31 +0100
commit0d5effd6afe8808296a01db102ca4c247cdcd1af (patch)
tree4f1113880606fb6dda861fd846f8ff40d5c17a63 /src/vega.h
parent3b3e4a221fa47d0109c6ab99be65b5ba48bae254 (diff)
downloadvega-0d5effd6afe8808296a01db102ca4c247cdcd1af.tar.gz
vega-0d5effd6afe8808296a01db102ca4c247cdcd1af.zip
Show filtered lists and their shared focus
A list may now be filtered (each t in tasks where !t.done), and several filtered lists over one list share one focus: the focus view names an item, so Vega asks Pure which row shows it and highlights it only in the list that holds it; the other lists have no focus (null in the web surface's JSON, and the spoken surface names the item where it is). A click or point on a row points at the item that row shows, and the wheel on a list without the focus focuses the row under it. Pure's rows now take a mutable app. examples/today.aup shows what is open and what is done; its CLI output matches a model over random adds, moves, toggles and points into either list, and the web surface leaves the other list without a focus.
Diffstat (limited to 'src/vega.h')
-rw-r--r--src/vega.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vega.h b/src/vega.h
index 98ed410..59a663e 100644
--- a/src/vega.h
+++ b/src/vega.h
@@ -45,14 +45,18 @@ unsigned vega_check(const PureModule *, void (*report)(void *, const char *name,
* shortest form. false when it has no value (for example a missing item). */
bool vega_text(PureApp *, uint32_t view, size_t row, char out[VEGA_TEXT], size_t *length);
bool vega_number(PureApp *, uint32_t view, size_t row, double *out);
-size_t vega_rows(const PureApp *, const VegaPart *);
-/* The focused row, clamped to the rows; 0 without a focus view. */
+size_t vega_rows(PureApp *, const VegaPart *);
+/* The row of the focused item: the focus view names an item (an index's
+ * position), shown on the row that holds it; VEGA_NO_ROW when a filtered
+ * list leaves that item out. Clamped to the rows without a filter; 0
+ * without a focus view. */
+#define VEGA_NO_ROW SIZE_MAX
size_t vega_focus(PureApp *, const VegaPart *);
/* Focus a row, as a user pointing at it (a click); false when the part's
* focus is not a plain index position or the row is not there. */
bool vega_point(PureApp *, const VegaPart *, size_t row);
/* The first row to show of `rows` when `visible` fit: the least scrolling
- * from first that keeps the focused row in view. */
+ * from first that keeps the focused row in view (any, without one). */
size_t vega_scroll(size_t first, size_t focus, size_t visible, size_t rows);
/* The key input answering a key name (Pure's names, as KeyboardEvent.code
* spells them), or -1; press sends its press and release. */