fixed width bug
a5f31f57
1 file(s) · +3 −3
| 83 | 83 | n = mw - (promptw + inputw + dc_textw(dc, "<") + dc_textw(dc, ">")); |
|
| 84 | 84 | ||
| 85 | 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 | 87 | break; |
|
| 88 | 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 | 90 | break; |
|
| 91 | 91 | } |
|
| 92 | 92 | ||
| 124 | 124 | dc_drawtext(dc, "<", normcol); |
|
| 125 | 125 | for(item = curr; item != next; item = item->right) { |
|
| 126 | 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 | 128 | dc_drawtext(dc, item->text, (item == sel) ? selcol : normcol); |
|
| 129 | 129 | } |
|
| 130 | 130 | dc->w = dc_textw(dc, ">"); |
|