From ccd149a329f9a33195c2c6216158e283f8993076 Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 16 Nov 2024 11:22:16 +0000 Subject: fix the menulist (make it play nice with periodic refreshing). before the addition of the timer for periodic matches updates the menulist was supposed to be refreshed manually by the user, and we didn't take into account the fact that every time you clear it and refill it loses its navigational parameters, i.e. which entry was selected and what's the offset if there are more entries than the visible window (Maxvisitems). so now we store those and reconfigure the menulist, adapting to its new state, so that the user experiences as little disruption as possible. --- dat.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dat.h') diff --git a/dat.h b/dat.h index f442103..c0a3e2f 100644 --- a/dat.h +++ b/dat.h @@ -236,8 +236,9 @@ struct Menulist Mlist; char *title; Rectangle r, sr; /* content and scroll rects */ + int maxvis; /* max amount of visible entries */ int high; /* [-1,nitems) where -1 is none */ - int off; /* entry offset ∈ [0, nitems-Maxvisitems] */ + int off; /* entry offset ∈ [0, nitems-maxvis] */ void (*add)(Menulist*, int, char*); void (*clear)(Menulist*); -- cgit v1.2.3