- for(i = allitem; 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++;
- }
-
- curroff = prevoff = nextoff = sel = item;
-
- update_offsets();
-}
-
-/* creates brush structs for brush mode drawing */
-static void
-draw_menu()
-{
- Item *i;
-
- brush.x = 0;
- brush.y = 0;
- brush.w = mw;
- brush.h = mh;
- draw(dpy, &brush, False, 0);
-
- /* print command */
- if(!title || text[0]) {
- cmdw = cw;
- if(cmdw && item)
- brush.w = cmdw;
- draw(dpy, &brush, False, text);
- }
- else {
- cmdw = tw;
- brush.w = cmdw;
- draw(dpy, &brush, False, title);
- }
- brush.x += brush.w;
-
- if(curroff) {
- brush.w = seek;
- draw(dpy, &brush, False, (curroff && curroff->left) ? "<" : 0);
- brush.x += brush.w;
-
- /* determine maximum items */
- for(i = curroff; i != nextoff; i=i->right) {
- brush.border = False;
- brush.w = textw(&brush.font, i->text);
- if(brush.w > mw / 3)
- brush.w = mw / 3;
- brush.w += brush.font.height;
- if(sel == i) {
- swap((void **)&brush.fg, (void **)&brush.bg);
- draw(dpy, &brush, True, i->text);
- swap((void **)&brush.fg, (void **)&brush.bg);
- }
- else
- draw(dpy, &brush, False, i->text);
- brush.x += brush.w;
- }