remove -l option
This commit is contained in:
parent
f59218c5f4
commit
df016717ca
@ -13,8 +13,6 @@ static const char *colors[SchemeLast][2] = {
|
|||||||
[SchemeSel] = { "#eeeeee", "#005577" },
|
[SchemeSel] = { "#eeeeee", "#005577" },
|
||||||
[SchemeOut] = { "#000000", "#00ffff" },
|
[SchemeOut] = { "#000000", "#00ffff" },
|
||||||
};
|
};
|
||||||
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
|
|
||||||
static unsigned int lines = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Characters not considered part of a word while deleting words
|
* Characters not considered part of a word while deleting words
|
||||||
|
@ -76,16 +76,13 @@ calcoffsets(void)
|
|||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
if (lines > 0)
|
|
||||||
n = lines * bh;
|
|
||||||
else
|
|
||||||
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
|
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
|
||||||
/* calculate which items will begin the next page and previous page */
|
/* calculate which items will begin the next page and previous page */
|
||||||
for (i = 0, next = curr; next; next = next->right)
|
for (i = 0, next = curr; next; next = next->right)
|
||||||
if ((i += (lines > 0) ? bh : MIN(TEXTW(next->text), n)) > n)
|
if ((i ? bh : MIN(TEXTW(next->text), n)) > n)
|
||||||
break;
|
break;
|
||||||
for (i = 0, prev = curr; prev && prev->left; prev = prev->left)
|
for (i = 0, prev = curr; prev && prev->left; prev = prev->left)
|
||||||
if ((i += (lines > 0) ? bh : MIN(TEXTW(prev->left->text), n)) > n)
|
if ((i ? bh : MIN(TEXTW(prev->left->text), n)) > n)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +138,7 @@ drawmenu(void)
|
|||||||
x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
|
x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
|
||||||
}
|
}
|
||||||
/* draw input field */
|
/* draw input field */
|
||||||
w = (lines > 0 || !matches) ? mw - x : inputw;
|
w = (!matches) ? mw - x : inputw;
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
|
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
|
||||||
|
|
||||||
@ -151,11 +148,7 @@ drawmenu(void)
|
|||||||
drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
|
drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lines > 0) {
|
if (matches) {
|
||||||
/* draw vertical list */
|
|
||||||
for (item = curr; item != next; item = item->right)
|
|
||||||
drawitem(item, x, y += bh, mw - x);
|
|
||||||
} else if (matches) {
|
|
||||||
/* draw horizontal list */
|
/* draw horizontal list */
|
||||||
x += inputw;
|
x += inputw;
|
||||||
w = TEXTW("<");
|
w = TEXTW("<");
|
||||||
@ -437,12 +430,10 @@ insert:
|
|||||||
calcoffsets();
|
calcoffsets();
|
||||||
break;
|
break;
|
||||||
case XK_Left:
|
case XK_Left:
|
||||||
if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
|
if (cursor > 0 && (!sel || !sel->left)) {
|
||||||
cursor = nextrune(-1);
|
cursor = nextrune(-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (lines > 0)
|
|
||||||
return;
|
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case XK_Up:
|
case XK_Up:
|
||||||
if (sel && sel->left && (sel = sel->left)->right == curr) {
|
if (sel && sel->left && (sel = sel->left)->right == curr) {
|
||||||
@ -477,8 +468,6 @@ insert:
|
|||||||
cursor = nextrune(+1);
|
cursor = nextrune(+1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (lines > 0)
|
|
||||||
return;
|
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case XK_Down:
|
case XK_Down:
|
||||||
if (sel && sel->right && (sel = sel->right) == next) {
|
if (sel && sel->right && (sel = sel->right) == next) {
|
||||||
@ -544,7 +533,6 @@ readstdin(void)
|
|||||||
if (items)
|
if (items)
|
||||||
items[i].text = NULL;
|
items[i].text = NULL;
|
||||||
inputw = items ? TEXTW(items[imax].text) : 0;
|
inputw = items ? TEXTW(items[imax].text) : 0;
|
||||||
lines = MIN(lines, i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -609,8 +597,7 @@ setup(void)
|
|||||||
|
|
||||||
/* calculate menu geometry */
|
/* calculate menu geometry */
|
||||||
bh = drw->fonts->h + 2;
|
bh = drw->fonts->h + 2;
|
||||||
lines = MAX(lines, 0);
|
mh = bh;
|
||||||
mh = (lines + 1) * bh;
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
i = 0;
|
i = 0;
|
||||||
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
|
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
|
||||||
@ -689,7 +676,7 @@ setup(void)
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
|
fputs("usage: dmenu [-bfiv] [-p prompt] [-fn font] [-m monitor]\n"
|
||||||
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
|
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -715,8 +702,6 @@ main(int argc, char *argv[])
|
|||||||
} else if (i + 1 == argc)
|
} else if (i + 1 == argc)
|
||||||
usage();
|
usage();
|
||||||
/* these options take one argument */
|
/* these options take one argument */
|
||||||
else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */
|
|
||||||
lines = atoi(argv[++i]);
|
|
||||||
else if (!strcmp(argv[i], "-m"))
|
else if (!strcmp(argv[i], "-m"))
|
||||||
mon = atoi(argv[++i]);
|
mon = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
|
else if (!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
|
||||||
|
Loading…
Reference in New Issue
Block a user