applied Sanders patch 38b866ba
anselm@anselm1 · 2008-03-12 21:37 2 file(s) · +7 −9
LICENSE +1 −1
1 1
MIT/X Consortium License
2 2
3 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 5
© 2006-2007 Michał Janeczek <janeczek at gmail dot com>
6 6
7 7
Permission is hereby granted, free of charge, to any person obtaining a
dmenu.c +6 −8
37 37
	Item *next;		/* traverses all items */
38 38
	Item *left, *right;	/* traverses items matching current search pattern */
39 39
	char *text;
40 -
	Bool matched;
41 40
};
42 41
43 42
/* forward declarations */
89 88
Item *prev = NULL;
90 89
Item *curr = NULL;
91 90
Window root, win;
91 +
int (*fstrncmp)(const char *, const char *, size_t n) = strncmp;
92 92
char *(*fstrstr)(const char *, const char *) = strstr;
93 93
94 94
Item *
97 97
		item = i;
98 98
	else
99 99
		last->right = i;
100 -
	i->matched = True;
101 100
	i->left = last;
102 101
	i->right = NULL;
103 102
	last = i;
505 504
	plen = strlen(pattern);
506 505
	item = j = NULL;
507 506
	nitem = 0;
508 -
	for(i = allitems; i; i=i->next)
509 -
		i->matched = False;
510 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 509
			j = appenditem(i, j);
513 -
	for(i = allitems; i; i = i->next)
514 -
		if(!i->matched && fstrstr(i->text, pattern))
510 +
		else if(fstrstr(i->text, pattern))
515 511
			j = appenditem(i, j);
516 512
	curr = prev = next = sel = item;
517 513
	calcoffsets();
662 658
663 659
	/* command line args */
664 660
	for(i = 1; i < argc; i++)
665 -
		if(!strcmp(argv[i], "-i"))
661 +
		if(!strcmp(argv[i], "-i")) {
662 +
			fstrncmp = strncasecmp;
666 663
			fstrstr = cistrstr;
664 +
		}
667 665
		else if(!strcmp(argv[i], "-fn")) {
668 666
			if(++i < argc) font = argv[i];
669 667
		}