aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
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/main.c
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/main.c')
-rw-r--r--src/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 46b672f..b9ea91e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -95,8 +95,10 @@ static bool mouse(unsigned button, unsigned line) {
const VegaPart *part = &screen.parts[index];
if (button == 64 || button == 65) {
size_t focus = vega_focus(&app, part), rows = vega_rows(&app, part);
- if (button == 64 ? !focus : focus + 1 >= rows) return false;
- item = button == 64 ? focus - 1 : focus + 1;
+ if (focus < rows) { /* else the wheel focuses the row under it */
+ if (button == 64 ? !focus : focus + 1 >= rows) return false;
+ item = button == 64 ? focus - 1 : focus + 1;
+ }
} else if (button) return false;
return vega_point(&app, part, item);
}