aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-01-10 00:04:25 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-01-13 22:56:48 +0000
commit9a6d629ccf328e3f041c3fcb7e91f49a5d72d0fb (patch)
treeb5be8391a6159d7b7fb3c9051c3d8368d10af05c /gdb
parentd8b2f9e3330ae76e33679c2628a6196542f329ca (diff)
downloadgdb-9a6d629ccf328e3f041c3fcb7e91f49a5d72d0fb.zip
gdb-9a6d629ccf328e3f041c3fcb7e91f49a5d72d0fb.tar.gz
gdb-9a6d629ccf328e3f041c3fcb7e91f49a5d72d0fb.tar.bz2
gdb/tui: Place window titles in the center of the border
In tui-wingeneral.c:box_win () a comment suggest we should display titles like this: +-WINDOW TITLE GOES HERE-+ However, we actually display them like this: +--WINDOW TITLE GOES HERE+ The former seems nicer to me, so that's what this commit does. Short titles will appear as: +-SHORT TITLE------------+ We previously didn't test the horizontal windows borders in the test suite, however, I've updated things so that we do now check for the '+-' and '-+' on the upper border, this will give us some protection. gdb/ChangeLog: * tui/tui-wingeneral.c (box_win): Position the title in the center of the border. gdb/testsuite/ChangeLog: * lib/tuiterm.exp (Term::_check_box): Check some parts of the top border. Change-Id: Iead6910e3b4e68bdf6871f861f23d2efd699faf0
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/lib/tuiterm.exp17
-rw-r--r--gdb/tui/tui-wingeneral.c4
4 files changed, 26 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f190405..f966da8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-13 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * tui/tui-wingeneral.c (box_win): Position the title in the center
+ of the border.
+
2020-01-13 Simon Marchi <simon.marchi@polymtl.ca>
* corelow.c (core_target::get_core_register_section): Use
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e83e219..10d7cbe 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-13 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * lib/tuiterm.exp (Term::_check_box): Check some parts of the top
+ border.
+
2020-01-10 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdb.multi/multi-target.exp (setup): Factor out "info
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index 7adaf1b..da55803 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -569,9 +569,20 @@ namespace eval Term {
return "lr corner"
}
- # Note we do not check the horizonal borders of the box. The
- # top will contain a title, and the bottom may as well, if it
- # is overlapped by some other border.
+ # Note we do not check the full horizonal borders of the box.
+ # The top will contain a title, and the bottom may as well, if
+ # it is overlapped by some other border. However, at most a
+ # title should appear as '+-VERY LONG TITLE-+', so we can
+ # check for the '+-' on the left, and '-+' on the right.
+ if {[get_char [expr {$x + 1}] $y] != "-"} {
+ return "ul title padding"
+ }
+
+ if {[get_char [expr {$x2 - 1}] $y] != "-"} {
+ return "ul title padding"
+ }
+
+ # Now check the vertical borders.
for {set i [expr {$y + 1}]} {$i < $y2 - 1} {incr i} {
if {[get_char $x $i] != "|"} {
return "left side $i"
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 0a9fc52..4331f63 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -75,13 +75,13 @@ box_win (struct tui_win_info *win_info,
int max_len = win_info->width - 2 - 2;
if (win_info->title.size () <= max_len)
- mvwaddstr (win, 0, 3, win_info->title.c_str ());
+ mvwaddstr (win, 0, 2, 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 ());
+ mvwaddstr (win, 0, 2, truncated.c_str ());
}
}
wattroff (win, attrs);