--- dmenu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dmenu.c b/dmenu.c index 3b05752..ad3a2f1 100644 --- a/dmenu.c +++ b/dmenu.c _AT_@ -198,7 +198,7 @@ match(void) char buf[sizeof text], *s; int i, tokc = 0; - size_t len, textsize; + size_t len, itemlen; struct item *item, *lprefix, *lsubstr, *prefixend, *substrend; strcpy(buf, text); _AT_@ -209,15 +209,16 @@ match(void) len = tokc ? strlen(tokv[0]) : 0; matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL; - textsize = strlen(text); for (item = items; item && item->text; item++) { for (i = 0; i < tokc; i++) if (!fstrstr(item->text, tokv[i])) break; if (i != tokc) /* not all tokens match */ continue; + + itemlen = strlen(item->text); /* exact matches go first, then prefixes, then substrings */ - if (!tokc || !fstrncmp(text, item->text, textsize)) + if (!tokc || !fstrncmp(text, item->text, itemlen)) appenditem(item, &matches, &matchend); else if (!fstrncmp(tokv[0], item->text, len)) appenditem(item, &lprefix, &prefixend); -- 2.7.4 --------------F09E9F238D41CCCABFE69258--Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Sun Aug 21 2016 - 06:00:14 CEST