summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2014-04-30 21:54:52 +0200
committerJuanma Barranquero <lekktu@gmail.com>2014-04-30 21:54:52 +0200
commit09b911adf4e22bbcac8c588bc14ade801276732e (patch)
tree0d9eb9708479bb491d7e1e2bb030aa3e90299526 /src/term.c
parentb0e36b7048c88aa24f6955c53fbe790bb9ebc54f (diff)
parent426b5dafdd837328d624a8ec5bfd567f2865c9f5 (diff)
downloademacs-09b911adf4e22bbcac8c588bc14ade801276732e.tar.gz
Merge from emacs-24; up to 2014-05-01T10:21:17Z!rgm@gnu.org
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c
index 6ea9a4eba9a..c636b8cac8b 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2924,6 +2924,13 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces,
menu_help_paneno = pn - 1;
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,
menu->submenu[j] != NULL);
}
@@ -3204,6 +3211,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
bool first_time;
Lisp_Object selectface;
int first_item = 0;
+ int col, row;
/* Don't allow non-positive x0 and y0, lest the menu will wrap
around the display. */
@@ -3391,7 +3399,14 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
faces, x, y, first_item, 1);
tty_hide_cursor (tty);
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);
}
+ else
+ row = -1;
/* Display the help-echo message for the currently-selected menu
item. */
@@ -3400,6 +3415,11 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
{
help_callback (menu_help_message,
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. */
+ if (0 <= row)
+ cursor_to (sf, row, col);
tty_hide_cursor (tty);
fflush (tty->output);
prev_menu_help_message = menu_help_message;