diff options
-rw-r--r-- | main.c | 21 |
1 files changed, 4 insertions, 17 deletions
@@ -120,19 +120,8 @@ match(char *pattern) { | |||
120 | nitem = 0; | 120 | nitem = 0; |
121 | 121 | ||
122 | for(i = allitems; i; i=i->next) | 122 | for(i = allitems; i; i=i->next) |
123 | if(!plen || !strncmp(pattern, i->text, plen)) { | 123 | if(plen ? !strncmp(pattern, i->text, plen) : |
124 | if(!j) | 124 | strncmp(pattern, i->text, plen) && strstr(i->text, pattern)) { |
125 | item = i; | ||
126 | else | ||
127 | j->right = i; | ||
128 | i->left = j; | ||
129 | i->right = NULL; | ||
130 | j = i; | ||
131 | nitem++; | ||
132 | } | ||
133 | for(i = allitems; i; i=i->next) | ||
134 | if(plen && strncmp(pattern, i->text, plen) | ||
135 | && strstr(i->text, pattern)) { | ||
136 | if(!j) | 125 | if(!j) |
137 | item = i; | 126 | item = i; |
138 | else | 127 | else |
@@ -208,10 +197,8 @@ kpress(XKeyEvent * e) { | |||
208 | } | 197 | } |
209 | break; | 198 | break; |
210 | case XK_Return: | 199 | case XK_Return: |
211 | if(e->state & ShiftMask) { | 200 | if((e->state & ShiftMask) && text) |
212 | if(text) | 201 | fprintf(stdout, "%s", text); |
213 | fprintf(stdout, "%s", text); | ||
214 | } | ||
215 | else if(sel) | 202 | else if(sel) |
216 | fprintf(stdout, "%s", sel->text); | 203 | fprintf(stdout, "%s", sel->text); |
217 | else if(text) | 204 | else if(text) |