more extended command help

For the searching capability offered by '# ?', use ':' instead of 's'
to activate it.  Otherwise, if the player typed ':', menu processing
would handle that and would search the few menu entries (for selectors
'a', 's'--now ':', and maybe 'z') when we're interested in searching
the data displayed via many separator lines.

I left 's' as the selector for "show all, clear search" once a search
has been performed, but perhaps that ought to be switched to ':' too.
This commit is contained in:
PatR
2018-09-27 03:52:23 -07:00
parent e0b7d2f5a9
commit dc3f497d56
+19 -4
View File
@@ -397,14 +397,24 @@ doextlist(VOID_ARGS)
if (!*searchbuf) { if (!*searchbuf) {
any.a_int = 2; any.a_int = 2;
add_menu(menuwin, NO_GLYPH, &any, 's', 0, ATR_NONE, /* was 's', but then using ':' handling within the interface
would only examine the two or three meta entries, not the
actual list of extended commands shown via separator lines;
having ':' as an explicit selector overrides the default
menu behavior for it; we retain 's' as a group accelerator */
add_menu(menuwin, NO_GLYPH, &any, ':', 's', ATR_NONE,
"Search extended commands", MENU_UNSELECTED); "Search extended commands", MENU_UNSELECTED);
} else { } else {
Strcpy(buf, "Show all, clear search"); Strcpy(buf, "Show all, clear search");
if (strlen(buf) + strlen(searchbuf) + strlen(" (\"\")") < QBUFSZ) if (strlen(buf) + strlen(searchbuf) + strlen(" (\"\")") < QBUFSZ)
Sprintf(eos(buf), " (\"%s\")", searchbuf); Sprintf(eos(buf), " (\"%s\")", searchbuf);
any.a_int = 3; any.a_int = 3;
add_menu(menuwin, NO_GLYPH, &any, 's', 0, ATR_NONE, /* specifying ':' as a group accelerator here is mostly a
statement of intent (we'd like to accept it as a synonym but
also want to hide it from general menu use) because it won't
work for interfaces which support ':' to search; use as a
general menu command takes precedence over group accelerator */
add_menu(menuwin, NO_GLYPH, &any, 's', ':', ATR_NONE,
buf, MENU_UNSELECTED); buf, MENU_UNSELECTED);
} }
if (wizard) { if (wizard) {
@@ -432,8 +442,13 @@ doextlist(VOID_ARGS)
continue; continue;
/* if searching, skip this command if it doesn't match */ /* if searching, skip this command if it doesn't match */
if (*searchbuf if (*searchbuf
/* first try case-insensitive substring match */
&& !strstri(efp->ef_txt, searchbuf) && !strstri(efp->ef_txt, searchbuf)
&& !strstri(efp->ef_desc, searchbuf)) && !strstri(efp->ef_desc, searchbuf)
/* wildcard support; most interfaces use case-insensitve
pmatch rather than regexp for menu searching */
&& !pmatchi(searchbuf, efp->ef_txt)
&& !pmatchi(searchbuf, efp->ef_desc))
continue; continue;
/* skip wizard mode commands if not in wizard mode; /* skip wizard mode commands if not in wizard mode;
when showing two sections, skip wizard mode commands when showing two sections, skip wizard mode commands
@@ -478,7 +493,7 @@ doextlist(VOID_ARGS)
menumode = 1 - menumode; /* toggle 0 -> 1, 1 -> 0 */ menumode = 1 - menumode; /* toggle 0 -> 1, 1 -> 0 */
redisplay = TRUE; redisplay = TRUE;
break; break;
case 2: /* 's' when not searching yet: enable search */ case 2: /* ':' when not searching yet: enable search */
search = TRUE; search = TRUE;
break; break;
case 3: /* 's' when already searching: disable search */ case 3: /* 's' when already searching: disable search */