instant-nodoc.patch (765B)
1 diff --git a/dmenu.c b/dmenu.c 2 index d605ab4..2c2f03e 100644 3 --- a/dmenu.c 4 +++ b/dmenu.c 5 @@ -260,6 +260,13 @@ match(void) 6 matchend = substrend; 7 } 8 curr = sel = matches; 9 + 10 + if(instant && matches && matches==matchend && !lsubstr) { 11 + puts(matches->text); 12 + cleanup(); 13 + exit(0); 14 + } 15 + 16 calcoffsets(); 17 } 18 19 @@ -659,7 +666,9 @@ main(int argc, char *argv[]) 20 else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ 21 fstrncmp = strncasecmp; 22 fstrstr = cistrstr; 23 - } else if (i + 1 == argc) 24 + } else if (!strcmp(argv[i], "-n")) /* instant select only match */ 25 + instant = 1; 26 + else if (i + 1 == argc) 27 usage(); 28 /* these options take one argument */ 29 else if (!strcmp(argv[i], "-l")) /* number of lines in vertical list */