Xinqi Bao's Git
projects
/
dmenu.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
540a787
)
applied Sanders patch
author
anselm@anselm1 <unknown>
Wed, 12 Mar 2008 21:37:43 +0000
(21:37 +0000)
committer
anselm@anselm1 <unknown>
Wed, 12 Mar 2008 21:37:43 +0000
(21:37 +0000)
LICENSE
patch
|
blob
|
history
dmenu.c
patch
|
blob
|
history
diff --git
a/LICENSE
b/LICENSE
index
2039f2a
..
8e87c0f
100644
(file)
--- a/
LICENSE
+++ b/
LICENSE
@@
-1,7
+1,7
@@
MIT/X Consortium License
© 2006-2008 Anselm R. Garbe <garbeam at gmail dot com>
MIT/X Consortium License
© 2006-2008 Anselm R. Garbe <garbeam at gmail dot com>
-© 2006-200
7
Sander van Dijk <a dot h dot vandijk at gmail dot com>
+© 2006-200
8
Sander van Dijk <a dot h dot vandijk at gmail dot com>
© 2006-2007 Michał Janeczek <janeczek at gmail dot com>
Permission is hereby granted, free of charge, to any person obtaining a
© 2006-2007 Michał Janeczek <janeczek at gmail dot com>
Permission is hereby granted, free of charge, to any person obtaining a
diff --git
a/dmenu.c
b/dmenu.c
index
864c8f0
..
ddde475
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-37,7
+37,6
@@
struct Item {
Item *next; /* traverses all items */
Item *left, *right; /* traverses items matching current search pattern */
char *text;
Item *next; /* traverses all items */
Item *left, *right; /* traverses items matching current search pattern */
char *text;
- Bool matched;
};
/* forward declarations */
};
/* forward declarations */
@@
-89,6
+88,7
@@
Item *next = NULL;
Item *prev = NULL;
Item *curr = NULL;
Window root, win;
Item *prev = NULL;
Item *curr = NULL;
Window root, win;
+int (*fstrncmp)(const char *, const char *, size_t n) = strncmp;
char *(*fstrstr)(const char *, const char *) = strstr;
Item *
char *(*fstrstr)(const char *, const char *) = strstr;
Item *
@@
-97,7
+97,6
@@
appenditem(Item *i, Item *last) {
item = i;
else
last->right = i;
item = i;
else
last->right = i;
- i->matched = True;
i->left = last;
i->right = NULL;
last = i;
i->left = last;
i->right = NULL;
last = i;
@@
-505,13
+504,10
@@
match(char *pattern) {
plen = strlen(pattern);
item = j = NULL;
nitem = 0;
plen = strlen(pattern);
item = j = NULL;
nitem = 0;
- for(i = allitems; i; i=i->next)
- i->matched = False;
for(i = allitems; i; i = i->next)
for(i = allitems; i; i = i->next)
- if(!
i->matched && !strncase
cmp(pattern, i->text, plen))
+ if(!
fstrn
cmp(pattern, i->text, plen))
j = appenditem(i, j);
j = appenditem(i, j);
- for(i = allitems; i; i = i->next)
- if(!i->matched && fstrstr(i->text, pattern))
+ else if(fstrstr(i->text, pattern))
j = appenditem(i, j);
curr = prev = next = sel = item;
calcoffsets();
j = appenditem(i, j);
curr = prev = next = sel = item;
calcoffsets();
@@
-662,8
+658,10
@@
main(int argc, char *argv[]) {
/* command line args */
for(i = 1; i < argc; i++)
/* command line args */
for(i = 1; i < argc; i++)
- if(!strcmp(argv[i], "-i"))
+ if(!strcmp(argv[i], "-i")) {
+ fstrncmp = strncasecmp;
fstrstr = cistrstr;
fstrstr = cistrstr;
+ }
else if(!strcmp(argv[i], "-fn")) {
if(++i < argc) font = argv[i];
}
else if(!strcmp(argv[i], "-fn")) {
if(++i < argc) font = argv[i];
}