aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-04-29 18:33:37 +0300
committerEli Zaretskii2014-04-29 18:33:37 +0300
commita55ea27f60f94ff3fc3e02e253056137fc56c35b (patch)
treec453f04cf112482b1467d2b5317d7a2dd025e571 /src/term.c
parent119bf2f4b11567f918c0ae3a052f63328b9dd36a (diff)
downloademacs-a55ea27f60f94ff3fc3e02e253056137fc56c35b.tar.gz
emacs-a55ea27f60f94ff3fc3e02e253056137fc56c35b.zip
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.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c
index 9e6cfe2f41d..354354fa745 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2897,6 +2897,13 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces,
2897 menu_help_paneno = pn - 1; 2897 menu_help_paneno = pn - 1;
2898 menu_help_itemno = j; 2898 menu_help_itemno = j;
2899 } 2899 }
2900 /* Take note of the coordinates of the active menu item, to
2901 display the cursor there. */
2902 if (mousehere)
2903 {
2904 row = y + i;
2905 col = x;
2906 }
2900 display_tty_menu_item (menu->text[j], max_width, face, x, y + i, 2907 display_tty_menu_item (menu->text[j], max_width, face, x, y + i,
2901 menu->submenu[j] != NULL); 2908 menu->submenu[j] != NULL);
2902 } 2909 }
@@ -3177,6 +3184,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3177 bool first_time; 3184 bool first_time;
3178 Lisp_Object selectface; 3185 Lisp_Object selectface;
3179 int first_item = 0; 3186 int first_item = 0;
3187 int col, row;
3180 3188
3181 /* Don't allow non-positive x0 and y0, lest the menu will wrap 3189 /* Don't allow non-positive x0 and y0, lest the menu will wrap
3182 around the display. */ 3190 around the display. */
@@ -3364,6 +3372,11 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3364 faces, x, y, first_item, 1); 3372 faces, x, y, first_item, 1);
3365 tty_hide_cursor (tty); 3373 tty_hide_cursor (tty);
3366 fflush (tty->output); 3374 fflush (tty->output);
3375 /* The call to display help-echo below will move the cursor,
3376 so remember its current position as computed by
3377 tty_menu_display. */
3378 col = cursorX (tty);
3379 row = cursorY (tty);
3367 } 3380 }
3368 3381
3369 /* Display the help-echo message for the currently-selected menu 3382 /* 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 { 3386 {
3374 help_callback (menu_help_message, 3387 help_callback (menu_help_message,
3375 menu_help_paneno, menu_help_itemno); 3388 menu_help_paneno, menu_help_itemno);
3389 /* Move the cursor to the beginning of the current menu
3390 item, so that screen readers and other accessibility aids
3391 know where the active region is. */
3392 cursor_to (sf, row, col);
3376 tty_hide_cursor (tty); 3393 tty_hide_cursor (tty);
3377 fflush (tty->output); 3394 fflush (tty->output);
3378 prev_menu_help_message = menu_help_message; 3395 prev_menu_help_message = menu_help_message;