]> git.armaanb.net Git - dmenu.git/commitdiff
Partially revert 44c7de3: fix items text width offset calculation
authorQuentin Rameau <quinq@fifth.space>
Mon, 25 Jul 2016 09:33:25 +0000 (11:33 +0200)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 25 Jul 2016 17:57:31 +0000 (19:57 +0200)
Without this, we discard the item if it's longer than assigned width
instead of truncating it.

dmenu.c

diff --git a/dmenu.c b/dmenu.c
index e926ecac26ec61f67f1add2e7ed12a6789f3ca50..8e84fbdf9afb6e572d2cae240d0d2801851c1765 100644 (file)
--- 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;
 }