diff options
| -rw-r--r-- | main.c | 21 |
1 files changed, 21 insertions, 0 deletions
| @@ -168,6 +168,14 @@ initfont(const char *fontstr) { | |||
| 168 | dc.font.height = dc.font.ascent + dc.font.descent; | 168 | dc.font.height = dc.font.ascent + dc.font.descent; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static int | ||
| 172 | strido(const char *text, const char *pattern) { | ||
| 173 | for(; *text && *pattern; text++) | ||
| 174 | if (*text == *pattern) | ||
| 175 | pattern++; | ||
| 176 | return !*pattern; | ||
| 177 | } | ||
| 178 | |||
| 171 | static void | 179 | static void |
| 172 | match(char *pattern) { | 180 | match(char *pattern) { |
| 173 | unsigned int plen; | 181 | unsigned int plen; |
| @@ -192,6 +200,19 @@ match(char *pattern) { | |||
| 192 | for(i = allitems; i; i=i->next) | 200 | for(i = allitems; i; i=i->next) |
| 193 | if(plen && strncmp(pattern, i->text, plen) | 201 | if(plen && strncmp(pattern, i->text, plen) |
| 194 | && strstr(i->text, pattern)) { | 202 | && strstr(i->text, pattern)) { |
| 203 | if(!j) | ||
| 204 | item = i; | ||
| 205 | else | ||
| 206 | j->right = i; | ||
| 207 | i->left = j; | ||
| 208 | i->right = NULL; | ||
| 209 | j = i; | ||
| 210 | nitem++; | ||
| 211 | } | ||
| 212 | for(i = allitems; i; i=i->next) | ||
| 213 | if(plen && strncmp(pattern, i->text, plen) | ||
| 214 | && !strstr(i->text, pattern) | ||
| 215 | && strido(i->text,pattern)) { | ||
| 195 | if(!j) | 216 | if(!j) |
| 196 | item = i; | 217 | item = i; |
| 197 | else | 218 | else |
