]> git.eshelyaron.com Git - emacs.git/commitdiff
* term.c (tty_menu_activate): Don't assume row and col are initialized.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 30 Apr 2014 17:54:27 +0000 (10:54 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 30 Apr 2014 17:54:27 +0000 (10:54 -0700)
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
src/term.c

index c98b8546788da7cbfa44396ac1e755d1d6357ed5..ab87645b48b967113d4b610a96fb035ea7f31e71 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-30  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * 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  <eliz@gnu.org>
 
        * term.c (tty_menu_display): Move the cursor to the active menu
index 354354fa745ddfb673162b83a870cbc30142ca59..3bbb21f15895fea020aa17e3deab255038c736ec 100644 (file)
@@ -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;