diff options
Diffstat (limited to 'gdb/tui/tui-data.c')
-rw-r--r-- | gdb/tui/tui-data.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 38a87a2..03395d2 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -169,13 +169,23 @@ tui_win_info::set_title (std::string &&new_title) /* See tui-data.h. */ void -tui_win_info::display_string (int y, int x, const char *str) const +tui_win_info::center_string (const char *str) { - int n = width - box_width () - x; - if (n <= 0) - return; + werase (handle.get ()); + check_and_display_highlight_if_needed (); + + int avail_width = width - box_size (); + int len = strlen (str); + + int x_pos = box_width (); + if (len < avail_width) + x_pos += (avail_width - len) / 2; + + int n = avail_width - x_pos; + gdb_assert (n > 0); - mvwaddnstr (handle.get (), y, x, str, n); + mvwaddnstr (handle.get (), height / 2, x_pos, str, n); + refresh_window (); } /* See tui-data.h. */ |