diff options
author | anselm@anselm1 <unknown> | 2008-03-12 21:37:43 +0000 |
---|---|---|
committer | anselm@anselm1 <unknown> | 2008-03-12 21:37:43 +0000 |
commit | 38b866ba3453e2a7567b084a353e50a36ed92221 (patch) | |
tree | 6bb12f58a285958e90e0504c58d2c50b3d5d2869 | |
parent | 540a78761b26b2af4f47e46d27ad6406548c8a1c (diff) |
applied Sanders patch
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | dmenu.c | 14 |
2 files changed, 7 insertions, 9 deletions
@@ -1,7 +1,7 @@ | |||
1 | MIT/X Consortium License | 1 | MIT/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 | ||
7 | Permission is hereby granted, free of charge, to any person obtaining a | 7 | Permission is hereby granted, free of charge, to any person obtaining a |
@@ -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; | |||
89 | Item *prev = NULL; | 88 | Item *prev = NULL; |
90 | Item *curr = NULL; | 89 | Item *curr = NULL; |
91 | Window root, win; | 90 | Window root, win; |
91 | int (*fstrncmp)(const char *, const char *, size_t n) = strncmp; | ||
92 | char *(*fstrstr)(const char *, const char *) = strstr; | 92 | char *(*fstrstr)(const char *, const char *) = strstr; |
93 | 93 | ||
94 | Item * | 94 | Item * |
@@ -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 | } |