-void
-drawmenuv(void) {
- Item *item;
- XWindowAttributes wa;
-
- dc.y = topbar ? dc.h : 0;
- dc.w = mw - dc.x;
- for(item = curr; item != next; item = item->right) {
- if(item == sel)
- drawbox(&dc, selcol);
- drawtext(&dc, item->text, (item == sel) ? selcol : normcol);
- dc.y += dc.h;
+ if(prompt) {
+ dc->w = promptw;
+ drawtext(dc, prompt, selcol);
+ dc->x = dc->w;
+ }
+ dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw;
+ drawtext(dc, text, normcol);
+ if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w)
+ drawrect(dc, curpos, 2, 1, dc->h - 4, FG(dc, normcol));
+
+ if(lines > 0) {
+ dc->w = mw - dc->x;
+ for(item = curr; item != next; item = item->right) {
+ dc->y += dc->h;
+ drawtext(dc, item->text, (item == sel) ? selcol : normcol);
+ }
+ }
+ else if(matches) {
+ dc->x += inputw;
+ dc->w = textw(dc, "<");
+ if(curr->left)
+ drawtext(dc, "<", normcol);
+ for(item = curr; item != next; item = item->right) {
+ dc->x += dc->w;
+ dc->w = MIN(textw(dc, item->text), mw/3);
+ drawtext(dc, item->text, (item == sel) ? selcol : normcol);
+ }
+ dc->w = textw(dc, ">");
+ dc->x = mw - dc->w;
+ if(next)
+ drawtext(dc, ">", normcol);