summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Lane Smith <cls@lubutu.com>2010-08-20 19:42:58 +0100
committerConnor Lane Smith <cls@lubutu.com>2010-08-20 19:42:58 +0100
commita5f31f570774ca1d4a504d8c13c96af0217635a7 (patch)
tree05aaa9eb19877c6974192691ca603a186e48c1a7
parentb81c1e88cdf637e184c5733c87a728df8471fe4e (diff)
fixed width bug
-rw-r--r--dmenu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dmenu.c b/dmenu.c
index 2596b56..5ae611f 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -83,10 +83,10 @@ calcoffsets(void) {
n = mw - (promptw + inputw + dc_textw(dc, "<") + dc_textw(dc, ">"));
for(i = 0, next = curr; next; next = next->right)
- if((i += (lines > 0) ? bh : dc_textw(dc, next->text)) > n)
+ if((i += (lines > 0) ? bh : MIN(dc_textw(dc, next->text), n)) > n)
break;
for(i = 0, prev = curr; prev && prev->left; prev = prev->left)
- if((i += (lines > 0) ? bh : dc_textw(dc, prev->left->text)) > n)
+ if((i += (lines > 0) ? bh : MIN(dc_textw(dc, prev->left->text), n)) > n)
break;
}
@@ -124,7 +124,7 @@ drawmenu(void) {
dc_drawtext(dc, "<", normcol);
for(item = curr; item != next; item = item->right) {
dc->x += dc->w;
- dc->w = dc_textw(dc, item->text);
+ dc->w = MIN(dc_textw(dc, item->text), mw - dc->x);
dc_drawtext(dc, item->text, (item == sel) ? selcol : normcol);
}
dc->w = dc_textw(dc, ">");