diff options
author | Connor Lane Smith <cls@lubutu.com> | 2010-08-20 19:42:58 +0100 |
---|---|---|
committer | Connor Lane Smith <cls@lubutu.com> | 2010-08-20 19:42:58 +0100 |
commit | a5f31f570774ca1d4a504d8c13c96af0217635a7 (patch) | |
tree | 05aaa9eb19877c6974192691ca603a186e48c1a7 | |
parent | b81c1e88cdf637e184c5733c87a728df8471fe4e (diff) |
fixed width bug
-rw-r--r-- | dmenu.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -83,10 +83,10 @@ calcoffsets(void) { | |||
83 | n = mw - (promptw + inputw + dc_textw(dc, "<") + dc_textw(dc, ">")); | 83 | n = mw - (promptw + inputw + dc_textw(dc, "<") + dc_textw(dc, ">")); |
84 | 84 | ||
85 | for(i = 0, next = curr; next; next = next->right) | 85 | for(i = 0, next = curr; next; next = next->right) |
86 | if((i += (lines > 0) ? bh : dc_textw(dc, next->text)) > n) | 86 | if((i += (lines > 0) ? bh : MIN(dc_textw(dc, next->text), n)) > n) |
87 | break; | 87 | break; |
88 | for(i = 0, prev = curr; prev && prev->left; prev = prev->left) | 88 | for(i = 0, prev = curr; prev && prev->left; prev = prev->left) |
89 | if((i += (lines > 0) ? bh : dc_textw(dc, prev->left->text)) > n) | 89 | if((i += (lines > 0) ? bh : MIN(dc_textw(dc, prev->left->text), n)) > n) |
90 | break; | 90 | break; |
91 | } | 91 | } |
92 | 92 | ||
@@ -124,7 +124,7 @@ drawmenu(void) { | |||
124 | dc_drawtext(dc, "<", normcol); | 124 | dc_drawtext(dc, "<", normcol); |
125 | for(item = curr; item != next; item = item->right) { | 125 | for(item = curr; item != next; item = item->right) { |
126 | dc->x += dc->w; | 126 | dc->x += dc->w; |
127 | dc->w = dc_textw(dc, item->text); | 127 | dc->w = MIN(dc_textw(dc, item->text), mw - dc->x); |
128 | dc_drawtext(dc, item->text, (item == sel) ? selcol : normcol); | 128 | dc_drawtext(dc, item->text, (item == sel) ? selcol : normcol); |
129 | } | 129 | } |
130 | dc->w = dc_textw(dc, ">"); | 130 | dc->w = dc_textw(dc, ">"); |