commit 11cb2e7dcc341e8c7409b26420a18de3fea99323 from: arg@f00b4r date: Tue Jul 24 16:19:09 2007 UTC applied ido-matching to dmenu commit - 07239bbddd22a6333495e3fab4e0a1e4878b0ca9 commit + 11cb2e7dcc341e8c7409b26420a18de3fea99323 blob - 9c10958d99ac12e5e611f56588555ea249d0339d blob + bf53763da3b77a8475a2939440b4d87ee62c1896 --- main.c +++ main.c @@ -168,6 +168,14 @@ initfont(const char *fontstr) { dc.font.height = dc.font.ascent + dc.font.descent; } +static int +strido(const char *text, const char *pattern) { + for(; *text && *pattern; text++) + if (*text == *pattern) + pattern++; + return !*pattern; +} + static void match(char *pattern) { unsigned int plen; @@ -192,6 +200,19 @@ match(char *pattern) { for(i = allitems; i; i=i->next) if(plen && strncmp(pattern, i->text, plen) && strstr(i->text, pattern)) { + if(!j) + item = i; + else + j->right = i; + i->left = j; + i->right = NULL; + j = i; + nitem++; + } + for(i = allitems; i; i=i->next) + if(plen && strncmp(pattern, i->text, plen) + && !strstr(i->text, pattern) + && strido(i->text,pattern)) { if(!j) item = i; else