From ed682dca2ddd80e56ffb38c126a968fea197f624 Mon Sep 17 00:00:00 2001 From: speedie Date: Sun, 19 Mar 2023 14:26:36 +0100 Subject: [PATCH] don't allow resizing client beyond number of items --- libs/client.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/client.c b/libs/client.c index 6c17d7a..bd3f0ce 100644 --- a/libs/client.c +++ b/libs/client.c @@ -47,9 +47,15 @@ void resizeclient(void) { int omh = mh; + struct item *item; + int itemCount = 0; + + // walk through all items + for (item = items; item && item->text; item++) + itemCount++; bh = MAX(drw->font->h, drw->font->h + 2 + lineheight); - lines = MAX(lines, 0); + lines = MIN(itemCount, MAX(lines, 0)); reallines = lines; #if USEIMAGE