summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmenu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dmenu.c b/dmenu.c
index e926eca..8e84fbd 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -81,10 +81,10 @@ calcoffsets(void)
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
/* calculate which items will begin the next page and previous page */
for (i = 0, next = curr; next; next = next->right)
- if ((i += (lines > 0) ? bh : TEXTW(next->text)) > n)
+ if ((i += (lines > 0) ? bh : MIN(TEXTW(next->text), n)) > n)
break;
for (i = 0, prev = curr; prev && prev->left; prev = prev->left)
- if ((i += (lines > 0) ? bh : TEXTW(prev->left->text)) > n)
+ if ((i += (lines > 0) ? bh : MIN(TEXTW(prev->left->text), n)) > n)
break;
}