MCPcopy Create free account
hub / github.com/NetHack/NetHack / search_menu

Function search_menu

win/X11/winmenu.c:473–503  ·  view source on GitHub ↗

common to menu_search and menu_key */

Source from the content-addressed store, hash-verified

471
472/* common to menu_search and menu_key */
473static void
474search_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
505static void
506select_all(struct xwindow *wp)

Callers 2

menu_keyFunction · 0.85
menu_searchFunction · 0.85

Calls 5

X11_getlinFunction · 0.85
eosFunction · 0.85
invert_matchFunction · 0.85
select_matchFunction · 0.85
X11_nhbellFunction · 0.85

Tested by

no test coverage detected