common to menu_search and menu_key */
| 471 | |
| 472 | /* common to menu_search and menu_key */ |
| 473 | static void |
| 474 | search_menu(struct xwindow *wp) |
| 475 | { |
| 476 | char *pat, buf[BUFSZ + 2]; /* room for '*' + BUFSZ-1 + '*' + '\0' */ |
| 477 | struct menu_info_t *menu_info = wp->menu_information; |
| 478 | |
| 479 | buf[0] = buf[1] = '\0'; |
| 480 | pat = &buf[1]; /* leave room to maybe insert '*' at front */ |
| 481 | if (menu_info->how != PICK_NONE) { |
| 482 | X11_getlin("Search for:", pat); |
| 483 | if (!*pat || *pat == '\033') |
| 484 | return; |
| 485 | /* convert "string" into "*string*" for use with pmatch() */ |
| 486 | if (*pat != '*') |
| 487 | *--pat = '*'; /* now points to &buf[0] */ |
| 488 | if (*(eos(pat) - 1) != '*') |
| 489 | Strcat(pat, "*"); |
| 490 | } |
| 491 | |
| 492 | switch (menu_info->how) { |
| 493 | case PICK_ANY: |
| 494 | invert_match(wp, pat); |
| 495 | break; |
| 496 | case PICK_ONE: |
| 497 | select_match(wp, pat); |
| 498 | break; |
| 499 | default: /* PICK_NONE */ |
| 500 | X11_nhbell(); |
| 501 | break; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | static void |
| 506 | select_all(struct xwindow *wp) |
no test coverage detected