-/* NetHack 3.5 wintty.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.71 $ */
+/* NetHack 3.5 wintty.c $NHDT-Date: 1427505884 2015/03/28 01:24:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.73 $ */
/* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
{
tty_menu_item *page_start, *page_end, *curr;
long count;
- int n, curr_page, page_lines;
+ int n, curr_page, page_lines, resp_len;
boolean finished, counting, reset_count;
char *cp, *rp, resp[QBUFSZ], gacc[QBUFSZ],
- *msave, *morestr;
+ *msave, *morestr, really_morc;
+#define MENU_EXPLICIT_CHOICE 0x7f /* pseudo menu manipulation char */
curr_page = page_lines = 0;
page_start = page_end = 0;
page_lines = 0;
}
*rp = 0;
+ /* remember how many explicit menu choices there are */
+ resp_len = (int)strlen(resp);
/* corner window - clear extra lines from last page */
if (cw->offx) {
xwaitforspace(resp);
}
- morc = map_menu_cmd(morc);
+ really_morc = morc; /* (only used with MENU_EXPLICIT_CHOICE */
+ if ((rp = index(resp, morc)) != 0 && rp < resp + resp_len)
+ /* explicit menu selection; don't override it if it also
+ happens to match a mapped menu command (such as ':' to
+ look inside a container vs ':' to search) */
+ morc = MENU_EXPLICIT_CHOICE;
+ else
+ morc = map_menu_cmd(morc);
+
switch (morc) {
case '0':
/* special case: '0' is also the default ball class */
}
}
break;
+ case MENU_EXPLICIT_CHOICE:
+ morc = really_morc;
+ /*FALLTHRU*/
default:
if (cw->how == PICK_NONE || !index(resp, morc)) {
/* unacceptable input received */