changeset: 365:6815880ca9d6
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Fri Aug 20 19:42:58 2010 +0100
files: dmenu.c
description:
fixed width bug
diff -r 837d5ddc9819 -r 6815880ca9d6 dmenu.c
--- a/dmenu.c Fri Aug 20 13:50:44 2010 +0100
+++ b/dmenu.c Fri Aug 20 19:42:58 2010 +0100
@@ -83,10 +83,10 @@
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 @@
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, ">");
Received on Fri Aug 20 2010 - 20:43:19 CEST
This archive was generated by hypermail 2.2.0 : Fri Aug 20 2010 - 20:48:03 CEST