From d1da6b01608841c846aa75209248e276f49e1587 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 11 Jul 2019 17:06:00 -0600 Subject: 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 * 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 * gdb.texinfo (TUI Configuration): Document new setting. Change-Id: I46ce9a68b12c9c79332d510f9c14b3c84b7efadd --- gdb/tui/tui-winsource.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gdb/tui/tui-winsource.h') diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index 7c3c626..8b96200 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -238,12 +238,16 @@ extern void tui_update_source_windows_with_line (struct symtab *, /* Extract some source text from PTR. LINE_NO is the line number. If it is positive, it is printed at the start of the line. FIRST_COL is the first column to extract, and LINE_WIDTH is the number of - characters to display. Returns a string holding the desired text. - PTR is updated to point to the start of the next line. */ + characters to display. NDIGITS is used to format the line number + (if it is positive). If NDIGITS is greater than 0, then that many + digits are used; otherwise the line number is formatted with 6 + digits and the text is aligned to the next tab stop. Returns a + string holding the desired text. PTR is updated to point to the + start of the next line. */ extern std::string tui_copy_source_line (const char **ptr, int line_no, int first_col, - int line_width); + int line_width, int ndigits); /* Constant definitions. */ #define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */ -- cgit v1.1