Commit a55ea27f authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Place hardware TTY cursor at the active menu item when displaying a menu.

 src/term.c (tty_menu_display): Move the cursor to the active menu
 item.
 (tty_menu_activate): Return the cursor to the active menu item
 after displaying the menu and after displaying help-echo.  See
 http://lists.gnu.org/archive/html/emacs-devel/2014-04/msg00402.html
 for the details of why this is needed by screen readers and
 Braille displays.
parent 119bf2f4
2014-04-29 Eli Zaretskii <eliz@gnu.org>
* term.c (tty_menu_display): Move the cursor to the active menu
item.
(tty_menu_activate): Return the cursor to the active menu item
after displaying the menu and after displaying help-echo. See
http://lists.gnu.org/archive/html/emacs-devel/2014-04/msg00402.html
for the details of why this is needed by screen readers and
Braille displays.
2014-04-29 Glenn Morris <rgm@gnu.org> 2014-04-29 Glenn Morris <rgm@gnu.org>
* process.c (handle_child_signal): * process.c (handle_child_signal):
......
...@@ -2897,6 +2897,13 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces, ...@@ -2897,6 +2897,13 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces,
menu_help_paneno = pn - 1; menu_help_paneno = pn - 1;
menu_help_itemno = j; menu_help_itemno = j;
} }
/* Take note of the coordinates of the active menu item, to
display the cursor there. */
if (mousehere)
{
row = y + i;
col = x;
}
display_tty_menu_item (menu->text[j], max_width, face, x, y + i, display_tty_menu_item (menu->text[j], max_width, face, x, y + i,
menu->submenu[j] != NULL); menu->submenu[j] != NULL);
} }
...@@ -3177,6 +3184,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, ...@@ -3177,6 +3184,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
bool first_time; bool first_time;
Lisp_Object selectface; Lisp_Object selectface;
int first_item = 0; int first_item = 0;
int col, row;
/* Don't allow non-positive x0 and y0, lest the menu will wrap /* Don't allow non-positive x0 and y0, lest the menu will wrap
around the display. */ around the display. */
...@@ -3364,6 +3372,11 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, ...@@ -3364,6 +3372,11 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
faces, x, y, first_item, 1); faces, x, y, first_item, 1);
tty_hide_cursor (tty); tty_hide_cursor (tty);
fflush (tty->output); fflush (tty->output);
/* The call to display help-echo below will move the cursor,
so remember its current position as computed by
tty_menu_display. */
col = cursorX (tty);
row = cursorY (tty);
} }
/* Display the help-echo message for the currently-selected menu /* Display the help-echo message for the currently-selected menu
...@@ -3373,6 +3386,10 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, ...@@ -3373,6 +3386,10 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
{ {
help_callback (menu_help_message, help_callback (menu_help_message,
menu_help_paneno, menu_help_itemno); menu_help_paneno, menu_help_itemno);
/* Move the cursor to the beginning of the current menu
item, so that screen readers and other accessibility aids
know where the active region is. */
cursor_to (sf, row, col);
tty_hide_cursor (tty); tty_hide_cursor (tty);
fflush (tty->output); fflush (tty->output);
prev_menu_help_message = menu_help_message; prev_menu_help_message = menu_help_message;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment