diff -r 7057efb48ef3 dmenu.c --- a/dmenu.c Tue Nov 02 12:15:15 2010 +0000 +++ b/dmenu.c Thu Nov 11 11:37:08 2010 +0000 @@ -54,6 +54,7 @@ static unsigned long normcol[ColLast]; static unsigned long selcol[ColLast]; static Atom utf8; +static Bool filter = False; static Bool topbar = True; static DC *dc; static Item *items = NULL; @@ -295,7 +296,16 @@ break; case XK_Return: case XK_KP_Enter: - fputs((sel && !(ev->state & ShiftMask)) ? sel->text : text, stdout); + if((ev->state & ShiftMask) || !sel) + puts(text); + else if(!filter) + puts(sel->text); + else { + for(Item *item = sel; item; item = item->right) + puts(item->text); + for(Item *item = matches; item != sel; item = item->right) + puts(item->text); + } fflush(stdout); exit(EXIT_SUCCESS); case XK_Right: @@ -491,7 +501,7 @@ void usage(void) { - fputs("usage: dmenu [-b] [-i] [-l lines] [-p prompt] [-fn font] [-nb color]\n" + fputs("usage: dmenu [-b] [-i] [-f] [-l lines] [-p prompt] [-fn font] [-nb color]\n" " [-nf color] [-sb color] [-sf color] [-v]\n", stderr); exit(EXIT_FAILURE); } @@ -509,6 +519,8 @@ } else if(!strcmp(argv[i], "-b")) topbar = False; + else if(!strcmp(argv[i], "-f")) + filter = True; else if(!strcmp(argv[i], "-i")) fstrncmp = strncasecmp; else if(i == argc-1)