ref: a6de25225e1f8958e9efab47ecd1134263d661b3
parent: 44a3faf02ec337da6377fa9a00e4ea7cb7d4e913
author: rodri <[email protected]>
date: Sun Oct 1 08:16:12 EDT 2023
fixed a Menulist.update bug where it would return 0 when there were no entries.
--- a/menulist.c
+++ b/menulist.c
@@ -68,10 +68,16 @@
/* redundant from bts.c:/^mouse\(, but it's necessary to avoid overdrawing */
static Mouse oldm;
static ulong lastlmbms;
+ Rectangle r;
int selected;
+ if(ml->nentries < 1)
+ return -1;
+
+ r = ml->nentries < Maxvisitems? ml->r: Rpt(ml->sr.min, ml->r.max);
+
selected = -1;
- if(ptinrect(mc->xy, Rpt(ml->sr.min, ml->r.max))){
+ if(ptinrect(mc->xy, r)){
if(ptinrect(mc->xy, ml->r)){
/* item highlighting and selection */
ml->high = ml->off + (mc->xy.y - ml->r.min.y)/(font->height+Vspace);