From bc6cb3efd06266e5f51862449700e2e559277095 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 30 Apr 2014 10:54:27 -0700 Subject: [PATCH] * term.c (tty_menu_activate): Don't assume row and col are initialized. GCC 4.9.0 warned about this, and I couldn't easily prove to my own satisfaction that they would always be initialized. --- src/ChangeLog | 6 ++++++ src/term.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index c98b8546788..ab87645b48b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-04-30 Paul Eggert + + * term.c (tty_menu_activate): Don't assume row and col are initialized. + GCC 4.9.0 warned about this, and I couldn't easily prove to my own + satisfaction that they would always be initialized. + 2014-04-29 Eli Zaretskii * term.c (tty_menu_display): Move the cursor to the active menu diff --git a/src/term.c b/src/term.c index 354354fa745..3bbb21f1589 100644 --- a/src/term.c +++ b/src/term.c @@ -3378,6 +3378,8 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, col = cursorX (tty); row = cursorY (tty); } + else + row = -1; /* Display the help-echo message for the currently-selected menu item. */ @@ -3389,7 +3391,8 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, /* 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); + if (0 <= row) + cursor_to (sf, row, col); tty_hide_cursor (tty); fflush (tty->output); prev_menu_help_message = menu_help_message; -- 2.39.5