In multiline mode the prompt is above the input
This commit is contained in:
parent
5573f5bd23
commit
9fbfcdcee2
21
dmenu.c
21
dmenu.c
@ -170,21 +170,26 @@ drawmenu(void)
|
||||
int x = 0, y = 0, w;
|
||||
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, 0, 0, mw, mh, 1, 1);
|
||||
drw_rect(drw, x, y, mw, mh, 1, 1);
|
||||
|
||||
if (prompt && *prompt) {
|
||||
drw_setscheme(drw, scheme[SchemeSel]);
|
||||
x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
|
||||
int prompt_x = drw_text(drw, x, y, promptw, bh, lrpad / 2, prompt, 0);
|
||||
if (lines > 0) {
|
||||
y += bh;
|
||||
} else {
|
||||
x += prompt_x;
|
||||
}
|
||||
}
|
||||
/* draw input field */
|
||||
w = (lines > 0 || !matches) ? mw - x : inputw;
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
|
||||
drw_text(drw, x, y, w, bh, lrpad / 2, text, 0);
|
||||
|
||||
curpos = TEXTW(text) - TEXTW(&text[cursor]);
|
||||
if ((curpos += lrpad / 2 - 1) < w) {
|
||||
drw_setscheme(drw, scheme[SchemeCaret]);
|
||||
drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
|
||||
drw_rect(drw, x + curpos, y + 2, 2, bh - 4, 1, 0);
|
||||
}
|
||||
|
||||
if (lines > 0) {
|
||||
@ -203,15 +208,15 @@ drawmenu(void)
|
||||
w = TEXTW("<");
|
||||
if (curr->left) {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0);
|
||||
drw_text(drw, x, y, w, bh, lrpad / 2, "<", 0);
|
||||
}
|
||||
x += w;
|
||||
for (item = curr; item != next; item = item->right)
|
||||
x = drawitem(item, x, 0, textw_clamp(item->stext, mw - x - TEXTW(">")));
|
||||
x = drawitem(item, x, y, textw_clamp(item->stext, mw - x - TEXTW(">")));
|
||||
if (next) {
|
||||
w = TEXTW(">");
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_text(drw, mw - w, 0, w, bh, lrpad / 2, ">", 0);
|
||||
drw_text(drw, mw - w, y, w, bh, lrpad / 2, ">", 0);
|
||||
}
|
||||
}
|
||||
drw_map(drw, win, 0, 0, mw, mh);
|
||||
@ -715,7 +720,7 @@ setup(void)
|
||||
/* calculate menu geometry */
|
||||
bh = drw->fonts->h + 2;
|
||||
lines = MAX(lines, 0);
|
||||
mh = (lines + 1) * bh;
|
||||
mh = (lines + 1 + (lines ? 1 : 0)) * bh;
|
||||
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
|
||||
#ifdef XINERAMA
|
||||
i = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user