fix a strange bug with option menu

It was impossible to select entry 62 in the allopt[] array
from the 'm O' menu, apparently because of a collision with
the ascii value of a question mark.

Entry 62 was currently the guicolor option.
This commit is contained in:
nhmall
2023-11-16 07:56:01 -05:00
parent d76176c41b
commit 7beef848c4

View File

@@ -8718,6 +8718,8 @@ term_for_boolean(int idx, boolean *b)
return boolean_term;
}
#define HELP_IDX (SIZE(allopt))
/* the #optionsfull command */
int
doset(void) /* changing options via menu by Per Liboriussen */
@@ -8766,7 +8768,7 @@ doset(void) /* changing options via menu by Per Liboriussen */
Sprintf(buf, "%4s%.75s", "", helptext[i]);
add_menu_str(tmpwin, buf);
} else {
any.a_int = '?' + 1; /* processing pick_list subtracts 1 */
any.a_int = HELP_IDX + 1; /* processing pick_list subtracts 1 */
add_menu(tmpwin, &nul_glyphinfo, &any, '?', '?', ATR_NONE,
clr, "view help for options menu",
MENU_ITEMFLAGS_SKIPINVERT);
@@ -8877,7 +8879,7 @@ doset(void) /* changing options via menu by Per Liboriussen */
*/
for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
opt_indx = pick_list[pick_idx].item.a_int - 1;
if (opt_indx == '?') {
if (opt_indx == HELP_IDX) {
display_file(OPTMENUHELP, FALSE);
gavehelp = TRUE;
continue; /* just handled '?'; there might be more picks */
@@ -8947,6 +8949,8 @@ doset(void) /* changing options via menu by Per Liboriussen */
return ECMD_OK;
}
#undef HELP_IDX
/* doset(#optionsfull command) menu entries for compound options */
static void
doset_add_menu(