This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: GDB 9 TUI mode broken
- From: Eli Zaretskii <eliz at gnu dot org>
- To: tom at tromey dot com
- Cc: midenok at gmail dot com, gdb-patches at sourceware dot org
- Date: Sat, 22 Feb 2020 20:46:37 +0200
- Subject: Re: GDB 9 TUI mode broken
- References: <CAF8BazBni=TZWTc5fbpdHU5bv1eM=24xpML46GCC2u4pFTkSAw@mail.gmail.com> <835zg5m7ib.fsf@gnu.org> <83mu9aj1pj.fsf@gnu.org> <87y2su5whg.fsf@tromey.com> <83ftf2iiqm.fsf@gnu.org>
> Date: Sat, 22 Feb 2020 20:23:29 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> CC: midenok@gmail.com, gdb-patches@sourceware.org
>
> > Your patch looks reasonable to me.
>
> Thanks, I will finish it off as suggested, and submit a full patch for
> review.
The below seems to DTRT. OK to commit?
2020-02-22 Eli Zaretskii <eliz@gnu.org>
* tui/tui-win.c (new_height_ok, tui_adjust_win_heights): Rename
'locator' to 'status_line', to better match terminology in the
manual.
(tui_adjust_win_heights): Resize the status_line window to match
the new dimensions of the command and source/disassembly windows.
Reported by Aleksey Midenkov <midenok@gmail.com>.
--- gdb/tui/tui-win.c~0 2020-02-08 14:50:14.000000000 +0200
+++ gdb/tui/tui-win.c 2020-02-22 20:39:24.847375000 +0200
@@ -1067,7 +1067,7 @@ tui_adjust_win_heights (struct tui_win_i
{
int diff;
struct tui_win_info *win_info;
- struct tui_locator_window *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *status_line = tui_locator_win_info_ptr ();
enum tui_layout_type cur_layout = tui_current_layout ();
int width = tui_term_width ();
@@ -1077,21 +1077,30 @@ tui_adjust_win_heights (struct tui_win_i
{
struct tui_win_info *src_win_info;
- primary_win_info->resize (new_height, width,
- 0, primary_win_info->origin.y);
if (primary_win_info->type == CMD_WIN)
{
win_info = *(tui_source_windows ().begin ());
src_win_info = win_info;
+ primary_win_info->resize (new_height, width,
+ 0,
+ primary_win_info->origin.y + diff);
+ win_info->resize (win_info->height + diff, width,
+ 0, win_info->origin.y);
+ status_line->resize (1, width, 0,
+ win_info->origin.y + win_info->height);
}
else
{
win_info = tui_win_list[CMD_WIN];
src_win_info = primary_win_info;
- }
+ primary_win_info->resize (new_height, width,
+ 0, primary_win_info->origin.y);
win_info->resize (win_info->height + diff, width,
- 0, win_info->origin.y);
- TUI_CMD_WIN->origin.y = locator->origin.y + 1;
+ 0, win_info->origin.y - diff);
+ status_line->resize (1, width, 0,
+ primary_win_info->origin.y
+ + primary_win_info->height);
+ }
if ((src_win_info->type == SRC_WIN
|| src_win_info->type == DISASSEM_WIN))
{
@@ -1122,7 +1131,7 @@ tui_adjust_win_heights (struct tui_win_i
if (primary_win_info == TUI_CMD_WIN)
{ /* Split the change in height across the 1st & 2nd
windows, adjusting them as well. */
- /* Subtract the locator. */
+ /* Subtract the status_line. */
int first_split_diff = diff / 2;
int second_split_diff = first_split_diff;
@@ -1160,12 +1169,12 @@ tui_adjust_win_heights (struct tui_win_i
second_win->resize (second_win->height + second_split_diff,
width,
0, first_win->height - 1);
- locator->resize (1, width,
+ status_line->resize (1, width,
0, (second_win->origin.y
+ second_win->height + 1));
TUI_CMD_WIN->resize (new_height, width,
- 0, locator->origin.y + 1);
+ 0, status_line->origin.y + 1);
}
else
{
@@ -1196,15 +1205,16 @@ tui_adjust_win_heights (struct tui_win_i
else
second_win->resize (second_win->height, width,
0, first_win->height - 1);
- locator->resize (1, width,
+ status_line->resize (1, width,
0, (second_win->origin.y
+ second_win->height + 1));
- TUI_CMD_WIN->origin.y = locator->origin.y + 1;
+ TUI_CMD_WIN->origin.y = status_line->origin.y + 1;
if ((TUI_CMD_WIN->height + diff) < 1)
- TUI_CMD_WIN->resize (1, width, 0, locator->origin.y + 1);
+ TUI_CMD_WIN->resize (1, width, 0,
+ status_line->origin.y + 1);
else
TUI_CMD_WIN->resize (TUI_CMD_WIN->height + diff, width,
- 0, locator->origin.y + 1);
+ 0, status_line->origin.y + 1);
}
if (src1 != nullptr && src1->content.empty ())
src1->erase_source_content ();
@@ -1272,13 +1282,14 @@ new_height_ok (struct tui_win_info *prim
/* We could simply add all the heights to obtain the same
result but below is more explicit since we subtract 1 for
the line that the first and second windows share, and add
- one for the locator. */
+ one for the status_line. */
total_height = cur_total_height =
(first_win->height + second_win->height - 1)
- + TUI_CMD_WIN->height + 1; /* Locator. */
+ + TUI_CMD_WIN->height + 1; /* Status_line. */
if (primary_win_info == TUI_CMD_WIN)
{
- /* Locator included since first & second win share a line. */
+ /* Status_line included since first and second window
+ share a line. */
ok = ((first_win->height +
second_win->height + diff) >=
(MIN_WIN_HEIGHT * 2)