fix ^ as choice in / menu for tty and X11

It turned out that using '^' as a group accelerator (new behavior for
the 'whatis' command to view traps) already worked for curses and Qt.
Fix that for tty and X11.  I don't know the situation for WinGUI.

Offering any of the menu paging keystrokes as group accelerators
should be avoided if there's any chance that the menu will need more
that one page.  The menu for '/' is short though so losing "^ to go
back to first page" for it isn't an issue.
This commit is contained in:
PatR
2023-10-14 17:24:39 -07:00
parent 1d0e4729bd
commit 2476329b2c
3 changed files with 16 additions and 5 deletions

View File

@@ -1777,6 +1777,8 @@ tty: changes to support TTY_PERM_INVENT resulted in blank inventory menu when
tty: for the !DEF_PAGER configuration, redraw screen properly if attempting
to display a file fails and tty_display_file()'s caller requests
feedback for that situation
tty: if a group accelerator matched a menu command ('^' in menu for '/')
it wouldn't work to select, just to manipulate the menu
Unix: after lua changes to Makefiles, 'make spotless' for dat subdirectory
left some generated data files which should have been deleted
Windows: new tile additions in win/share did not trigger the creation of a new
@@ -1802,6 +1804,8 @@ X11: use visctrl(response) when X11_yn_function() echoes prompt+response in
X11: when trying to lookup scrollbars in order to handle scrolling via keys,
menu handling always ended up finding the top window
X11: enable horizontal scrollbar for persistent inventory window
X11: if a group accelerator matched a menu command ('^' in menu for '/')
it wouldn't work to select, just to manipulate the menu
X11+macOS: after the "bad Atom" fix (below), the persistent inventory window
crept downward every time it got updated

View File

@@ -254,9 +254,11 @@ menu_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
if (menu_info->is_active || perminv_scrolling) { /* handle the input */
/* first check for an explicit selector match, so that it won't be
overridden if it happens to duplicate a mapped menu command (':'
to look inside a container vs ':' to select via search string) */
to look inside a container vs ':' to select via search string);
check for group accelerator match too */
for (curr = menu_info->curr_menu.base; curr; curr = curr->next)
if (curr->identifier.a_void != 0 && curr->selector == ch)
if (curr->identifier.a_void != 0
&& (curr->selector == ch || curr->gselector == ch))
goto make_selection;
ch = map_menu_cmd(ch);
@@ -366,7 +368,8 @@ menu_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
selected_something = FALSE;
for (count = 0, curr = menu_info->curr_menu.base; curr;
curr = curr->next, count++)
if (curr->identifier.a_void != 0 && curr->selector == ch)
if (curr->identifier.a_void != 0
&& (curr->selector == ch || curr->gselector == ch))
break;
if (curr) {

View File

@@ -1493,11 +1493,15 @@ process_menu_window(winid window, struct WinDesc *cw)
}
}
/* set extra chars.. */
Strcat(resp, default_menu_cmds);
if (*gacc) {
Strcat(resp, gacc); /* group accelerators */
if (cw->how == PICK_ONE)
resp_len = (int) strlen(resp);
}
Strcat(resp, " "); /* next page or end */
Strcat(resp, "0123456789\033\n\r"); /* counts, quit */
Strcat(resp, gacc); /* group accelerators */
Strcat(resp, gm.mapped_menu_cmds);
Strcat(resp, default_menu_cmds);
if (cw->npages > 1)
Sprintf(cw->morestr, "(%d of %d)", curr_page + 1,