aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE2
-rw-r--r--dmenu.c14
2 files changed, 7 insertions, 9 deletions
diff --git a/LICENSE b/LICENSE
index 2039f2a..8e87c0f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,7 +1,7 @@
1MIT/X Consortium License 1MIT/X Consortium License
2 2
3© 2006-2008 Anselm R. Garbe <garbeam at gmail dot com> 3© 2006-2008 Anselm R. Garbe <garbeam at gmail dot com>
4© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com> 4© 2006-2008 Sander van Dijk <a dot h dot vandijk at gmail dot com>
5© 2006-2007 Michał Janeczek <janeczek at gmail dot com> 5© 2006-2007 Michał Janeczek <janeczek at gmail dot com>
6 6
7Permission is hereby granted, free of charge, to any person obtaining a 7Permission is hereby granted, free of charge, to any person obtaining a
diff --git a/dmenu.c b/dmenu.c
index 864c8f0..ddde475 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -37,7 +37,6 @@ struct Item {
37 Item *next; /* traverses all items */ 37 Item *next; /* traverses all items */
38 Item *left, *right; /* traverses items matching current search pattern */ 38 Item *left, *right; /* traverses items matching current search pattern */
39 char *text; 39 char *text;
40 Bool matched;
41}; 40};
42 41
43/* forward declarations */ 42/* forward declarations */
@@ -89,6 +88,7 @@ Item *next = NULL;
89Item *prev = NULL; 88Item *prev = NULL;
90Item *curr = NULL; 89Item *curr = NULL;
91Window root, win; 90Window root, win;
91int (*fstrncmp)(const char *, const char *, size_t n) = strncmp;
92char *(*fstrstr)(const char *, const char *) = strstr; 92char *(*fstrstr)(const char *, const char *) = strstr;
93 93
94Item * 94Item *
@@ -97,7 +97,6 @@ appenditem(Item *i, Item *last) {
97 item = i; 97 item = i;
98 else 98 else
99 last->right = i; 99 last->right = i;
100 i->matched = True;
101 i->left = last; 100 i->left = last;
102 i->right = NULL; 101 i->right = NULL;
103 last = i; 102 last = i;
@@ -505,13 +504,10 @@ match(char *pattern) {
505 plen = strlen(pattern); 504 plen = strlen(pattern);
506 item = j = NULL; 505 item = j = NULL;
507 nitem = 0; 506 nitem = 0;
508 for(i = allitems; i; i=i->next)
509 i->matched = False;
510 for(i = allitems; i; i = i->next) 507 for(i = allitems; i; i = i->next)
511 if(!i->matched && !strncasecmp(pattern, i->text, plen)) 508 if(!fstrncmp(pattern, i->text, plen))
512 j = appenditem(i, j); 509 j = appenditem(i, j);
513 for(i = allitems; i; i = i->next) 510 else if(fstrstr(i->text, pattern))
514 if(!i->matched && fstrstr(i->text, pattern))
515 j = appenditem(i, j); 511 j = appenditem(i, j);
516 curr = prev = next = sel = item; 512 curr = prev = next = sel = item;
517 calcoffsets(); 513 calcoffsets();
@@ -662,8 +658,10 @@ main(int argc, char *argv[]) {
662 658
663 /* command line args */ 659 /* command line args */
664 for(i = 1; i < argc; i++) 660 for(i = 1; i < argc; i++)
665 if(!strcmp(argv[i], "-i")) 661 if(!strcmp(argv[i], "-i")) {
662 fstrncmp = strncasecmp;
666 fstrstr = cistrstr; 663 fstrstr = cistrstr;
664 }
667 else if(!strcmp(argv[i], "-fn")) { 665 else if(!strcmp(argv[i], "-fn")) {
668 if(++i < argc) font = argv[i]; 666 if(++i < argc) font = argv[i];
669 } 667 }