]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use getcurx in curses code
authorTom Tromey <tom@tromey.com>
Tue, 28 Jun 2016 20:25:49 +0000 (14:25 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 14 Jul 2016 16:35:38 +0000 (10:35 -0600)
As suggested by Pedro, this changes a few spots to use getcurx, rather
than getyx.  This avoids some unused variable warnings.

2016-07-14  Tom Tromey  <tom@tromey.com>

* tui/tui-winsource.c (tui_show_source_line): Use getcurx.
* tui/tui-io.c (tui_puts): Use getcurx.
(tui_redisplay_readline): Likewise.

gdb/ChangeLog
gdb/tui/tui-io.c
gdb/tui/tui-winsource.c

index f5c00726dcb1e6117f80319cada40b736699615e..69613830b85f23d6adf2c60c184d25ed6abf3772 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-14  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-winsource.c (tui_show_source_line): Use getcurx.
+       * tui/tui-io.c (tui_puts): Use getcurx.
+       (tui_redisplay_readline): Likewise.
+
 2016-07-14  Tom Tromey  <tom@tromey.com>
 
        * inflow.c (child_terminal_ours_1): Use ATTRIBUTE_UNUSED.
index ed79b4441445c68b2917e311fda42119c5dd17aa..93bed88328152c0ac8d3a232c9f9d88386d49e23 100644 (file)
@@ -172,9 +172,9 @@ tui_puts (const char *string)
          /* Expand TABs, since ncurses on MS-Windows doesn't.  */
          if (c == '\t')
            {
-             int line, col;
+             int col;
 
-             getyx (w, line, col);
+             col = getcurx (w);
              do
                {
                  waddch (w, ' ');
@@ -198,7 +198,7 @@ tui_redisplay_readline (void)
 {
   int prev_col;
   int height;
-  int col, line;
+  int col;
   int c_pos;
   int c_line;
   int in;
@@ -230,7 +230,7 @@ tui_redisplay_readline (void)
   for (in = 0; prompt && prompt[in]; in++)
     {
       waddch (w, prompt[in]);
-      getyx (w, line, col);
+      col = getcurx (w);
       if (col <= prev_col)
         height++;
       prev_col = col;
@@ -256,7 +256,7 @@ tui_redisplay_readline (void)
       else if (c == '\t')
        {
          /* Expand TABs, since ncurses on MS-Windows doesn't.  */
-         getyx (w, line, col);
+         col = getcurx (w);
          do
            {
              waddch (w, ' ');
@@ -269,7 +269,7 @@ tui_redisplay_readline (void)
        }
       if (c == '\n')
        TUI_CMD_WIN->detail.command_info.start_line = getcury (w);
-      getyx (w, line, col);
+      col = getcurx (w);
       if (col < prev_col)
         height++;
       prev_col = col;
index 48975b6e3c2b0f5f34a14dfebe3554aa83f15728..09080b841af09b9196f16316a8c637433233af1f 100644 (file)
@@ -273,7 +273,7 @@ static void
 tui_show_source_line (struct tui_win_info *win_info, int lineno)
 {
   struct tui_win_element *line;
-  int x, y;
+  int x;
 
   line = win_info->generic.content[lineno - 1];
   if (line->which_element.source.is_exec_point)
@@ -285,11 +285,11 @@ tui_show_source_line (struct tui_win_info *win_info, int lineno)
     wattroff (win_info->generic.handle, A_STANDOUT);
 
   /* Clear to end of line but stop before the border.  */
-  getyx (win_info->generic.handle, y, x);
+  x = getcurx (win_info->generic.handle);
   while (x + 1 < win_info->generic.width)
     {
       waddch (win_info->generic.handle, ' ');
-      getyx (win_info->generic.handle, y, x);
+      x = getcurx (win_info->generic.handle);
     }
 }