Use ui_out for "info win"
authorTom Tromey <tom@tromey.com>
Thu, 18 Jul 2019 20:53:42 +0000 (14:53 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 9 Sep 2019 23:06:22 +0000 (17:06 -0600)
This changes the "info win" command to use ui-out.  This yields
somewhat nicer table output.

gdb/ChangeLog
2019-09-09  Tom Tromey  <tom@tromey.com>

* tui/tui-win.c (tui_all_windows_info): Use ui_out.

gdb/ChangeLog
gdb/tui/tui-win.c

index eb6d06281212c99308d5efa4d04edf3593b6643f..542f37fca0075351dfaa71069ea0619c6cd36056 100644 (file)
@@ -1,3 +1,7 @@
+2019-09-09  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-win.c (tui_all_windows_info): Use ui_out.
+
 2019-09-09  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * python/python.c (do_start_initialization): Make progname_copy static,
index 8d41372cf901c20c82fe0c5aeb49fcd8b9474ec1..bf84cdac442cc7751ba65e23c42a3dff20f3f26c 100644 (file)
@@ -828,18 +828,26 @@ static void
 tui_all_windows_info (const char *arg, int from_tty)
 {
   struct tui_win_info *win_with_focus = tui_win_with_focus ();
+  struct ui_out *uiout = current_uiout;
+
+  ui_out_emit_table table_emitter (uiout, 3, -1, "tui-windows");
+  uiout->table_header (10, ui_left, "name", "Name");
+  uiout->table_header (5, ui_right, "lines", "Lines");
+  uiout->table_header (10, ui_left, "focus", "Focus");
+  uiout->table_body ();
 
   for (tui_win_info *win_info : all_tui_windows ())
     if (win_info->is_visible ())
       {
+       ui_out_emit_tuple tuple_emitter (uiout, nullptr);
+
+       uiout->field_string ("name", win_info->name ());
+       uiout->field_signed ("lines", win_info->height);
        if (win_with_focus == win_info)
-         printf_filtered ("        %s\t(%d lines)  <has focus>\n",
-                          win_info->name (),
-                          win_info->height);
+         uiout->field_string ("focus", _("(has focus)"));
        else
-         printf_filtered ("        %s\t(%d lines)\n",
-                          win_info->name (),
-                          win_info->height);
+         uiout->field_skip ("focus");
+       uiout->text ("\n");
       }
 }