aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-07-18 15:07:01 -0600
committerTom Tromey <tom@tromey.com>2019-09-08 14:06:54 -0600
commit8634b4628ea00a95ce3dfe8f9915724e8d710dad (patch)
treed4344fb5ae0483d96a8e772fa7091c3898721eda /gdb/tui
parentb26b24e0278f9746913a6f8add7d0e3533934adb (diff)
downloadgdb-8634b4628ea00a95ce3dfe8f9915724e8d710dad.zip
gdb-8634b4628ea00a95ce3dfe8f9915724e8d710dad.tar.gz
gdb-8634b4628ea00a95ce3dfe8f9915724e8d710dad.tar.bz2
Truncate long TUI window titles
If a TUI window has a long title, it can overflow the title line. This changes the TUI to use just the tail part of the title in this case. gdb/ChangeLog 2019-09-08 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (box_win): Truncate long window titles. gdb/testsuite/ChangeLog 2019-09-08 Tom Tromey <tom@tromey.com> * gdb.tui/resize.exp: Remove setup_xfail. * gdb.tui/regs.exp: Remove setup_xfail. * gdb.tui/basic.exp: Remove setup_xfail.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-wingeneral.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index f900eab..235c17c 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -74,7 +74,21 @@ box_win (struct tui_win_info *win_info,
box (win, tui_border_vline, tui_border_hline);
#endif
if (!win_info->title.empty ())
- mvwaddstr (win, 0, 3, win_info->title.c_str ());
+ {
+ /* Emit "+-TITLE-+" -- so 2 characters on the right and 2 on
+ the left. */
+ int max_len = win_info->width - 2 - 2;
+
+ if (win_info->title.size () <= max_len)
+ mvwaddstr (win, 0, 3, win_info->title.c_str ());
+ else
+ {
+ std::string truncated
+ = "..." + win_info->title.substr (win_info->title.size ()
+ - max_len + 3);
+ mvwaddstr (win, 0, 3, truncated.c_str ());
+ }
+ }
wattroff (win, attrs);
}