2nd follow-up to alternative fix for menu search (':')

This commit is contained in:
nhmall
2023-11-17 14:13:58 -05:00
parent b3024c3c6c
commit d7ed474fa7
4 changed files with 25 additions and 6 deletions

View File

@@ -3442,6 +3442,8 @@ extern void add_menu(winid, const glyph_info *, const ANY_P *,
char, char, int, int, const char *, unsigned int);
extern void add_menu_heading(winid, const char *);
extern void add_menu_str(winid, const char *);
extern int select_menu(winid, int, menu_item **);
extern void getlin(const char *, char *);
/* ### windows.c ### */

View File

@@ -125,13 +125,15 @@ extern
#define putmixed (*windowprocs.win_putmixed)
#define display_file (*windowprocs.win_display_file)
#define start_menu (*windowprocs.win_start_menu)
/* 3.7: There is a real add_menu() in the core now, which does
* some common activities, such as menu_colors.
* add_menu() is in windows.c
#define end_menu (*windowprocs.win_end_menu)
/* 3.7: There are real add_menu() and select_menu
* in the core now.
* add_menu does some common activities, such as menu_colors.
* select_menu does some before and after activities.
* add_menu() and select_menu() are in windows.c
*/
/* #define add_menu (*windowprocs.win_add_menu) */
#define end_menu (*windowprocs.win_end_menu)
#define select_menu (*windowprocs.win_select_menu)
/* #define select_menu (*windowprocs.win_select_menu) */
#define message_menu (*windowprocs.win_message_menu)
#define mark_synch (*windowprocs.win_mark_synch)

View File

@@ -8739,7 +8739,8 @@ doset(void) /* changing options via menu by Per Liboriussen */
menu_item *pick_list;
int indexoffset, startpass, endpass;
boolean setinitial = FALSE, fromfile = FALSE,
gavehelp = FALSE, skiphelp = !iflags.cmdassist;
gavehelp = FALSE, skiphelp = !iflags.cmdassist,
save_bot_disabled;
int clr = NO_COLOR;
if (iflags.menu_requested) {
@@ -8874,6 +8875,8 @@ doset(void) /* changing options via menu by Per Liboriussen */
end_menu(tmpwin, "Set what options?");
go.opt_need_redraw = FALSE;
go.opt_need_glyph_reset = FALSE;
save_bot_disabled = gb.bot_disabled;
gb.bot_disabled = TRUE;
if ((pick_cnt = select_menu(tmpwin, PICK_ANY, &pick_list)) > 0) {
/*
* Walk down the selection list and either invert the booleans
@@ -8930,6 +8933,7 @@ doset(void) /* changing options via menu by Per Liboriussen */
}
destroy_nhwindow(tmpwin);
gb.bot_disabled = save_bot_disabled;
if (pick_cnt == 1 && gavehelp) {
/* when '?' is only the thing selected, go back and pick all

View File

@@ -1679,6 +1679,17 @@ get_menu_coloring(const char *str, int *color, int *attr)
return FALSE;
}
int select_menu(winid window, int how, menu_item **menu_list)
{
int reslt;
boolean old_bot_disabled = gb.bot_disabled;
gb.bot_disabled = TRUE;
reslt = (*windowprocs.win_select_menu)(window, how, menu_list);
gb.bot_disabled = old_bot_disabled;
return reslt;
}
void
getlin(const char *query, register char *bufp)
{