public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Use ui_out for "info win"
@ 2019-09-09 23:11 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-09-09 23:11 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=25a2915e8dba63abef6d7434114f36efeb5c09fe

commit 25a2915e8dba63abef6d7434114f36efeb5c09fe
Author: Tom Tromey <tom@tromey.com>
Date:   Thu Jul 18 14:53:42 2019 -0600

    Use ui_out for "info win"
    
    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.

Diff:
---
 gdb/ChangeLog     |  4 ++++
 gdb/tui/tui-win.c | 20 ++++++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eb6d062..542f37f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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,
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 8d41372..bf84cda 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -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");
       }
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-09 23:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 23:11 [binutils-gdb] Use ui_out for "info win" Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).