aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-win.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-07-11 17:06:00 -0600
committerTom Tromey <tom@tromey.com>2019-12-01 11:59:23 -0700
commitd1da6b01608841c846aa75209248e276f49e1587 (patch)
treee3a2f0b33cacf71c077a015f2647690086e70ef9 /gdb/tui/tui-win.c
parent489dbda6a8d6d54bbc349c7048553fc5f791cb41 (diff)
downloadgdb-d1da6b01608841c846aa75209248e276f49e1587.zip
gdb-d1da6b01608841c846aa75209248e276f49e1587.tar.gz
gdb-d1da6b01608841c846aa75209248e276f49e1587.tar.bz2
Allow using less horizontal space in TUI source window
The source window currently uses a field width of 6 for line numbers, and it further aligns to the next tab stop. This seemed a bit wasteful of horizontal space to me, so I changed that in an earlier patch. However, that change wasn't universally popular. This patch instead adds the option to use less horizontal space in the TUI source window. gdb/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_copy_source_line): Add "ndigits" parameter. * tui/tui-winsource.c (tui_copy_source_line): Add "ndigits" parameter. * tui/tui-win.h (compact_source): Declare. * tui/tui-win.c (compact_source): New global. (tui_set_compact_source, tui_show_compact_source): New functions. (_initialize_tui_win): Add "compact-source" setting. * tui/tui-source.c (tui_source_window::set_contents): Handle compact_source setting. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. * NEWS: Document new setting. gdb/doc/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Configuration): Document new setting. Change-Id: I46ce9a68b12c9c79332d510f9c14b3c84b7efadd
Diffstat (limited to 'gdb/tui/tui-win.c')
-rw-r--r--gdb/tui/tui-win.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index f47dad8..576f9a5 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -927,6 +927,29 @@ tui_show_tab_width (struct ui_file *file, int from_tty,
}
+/* See tui-win.h. */
+
+bool compact_source = false;
+
+/* Callback for "set tui compact-source". */
+
+static void
+tui_set_compact_source (const char *ignore, int from_tty,
+ struct cmd_list_element *c)
+{
+ if (TUI_SRC_WIN != nullptr)
+ TUI_SRC_WIN->refill ();
+}
+
+/* Callback for "show tui compact-source". */
+
+static void
+tui_show_compact_source (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ printf_filtered (_("TUI source window compactness is %s.\n"), value);
+}
+
/* Set the tab width of the specified window. */
static void
tui_set_tab_width_command (const char *arg, int from_tty)
@@ -1484,4 +1507,14 @@ When enabled GDB will print a message when the terminal is resized."),
show_tui_resize_message,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
+
+ add_setshow_boolean_cmd ("compact-source", class_tui,
+ &compact_source, _("\
+Set whether the TUI source window is compact."), _("\
+Show whether the TUI source window is compact."), _("\
+This variable controls whether the TUI source window is shown\n\
+in a compact form. The compact form puts the source closer to\n\
+the line numbers and uses less horizontal space."),
+ tui_set_compact_source, tui_show_compact_source,
+ &tui_setlist, &tui_showlist);
}