From: Hannes Domani Date: Tue, 5 Jan 2021 16:29:02 +0000 (+0100) Subject: Don't draw register sub windows outside the visible area X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4cf28e918accb76e8f343eee40c4955b4969f335;p=binutils-gdb.git Don't draw register sub windows outside the visible area If the regs window is not big enough to show all registers, the registers whose values changed are always drawn, even if they are not in the currently visible area. So this marks the invisible register sub windows with y=0, and skips their rerender call in check_register_values. gdb/ChangeLog: 2021-02-07 Hannes Domani * tui/tui-regs.c (tui_data_window::display_registers_from): Mark invisible register sub windows. (tui_data_window::check_register_values): Ignore invisible register sub windows. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 20f3541a634..669aa2d08fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2021-02-07 Hannes Domani + + * tui/tui-regs.c (tui_data_window::display_registers_from): + Mark invisible register sub windows. + (tui_data_window::check_register_values): Ignore invisible + register sub windows. + 2021-02-07 Hannes Domani * tui/tui-regs.c (tui_data_item_window::rerender): Don't call diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 5caff7195ef..a9387368bbe 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -281,7 +281,11 @@ tui_data_window::display_registers_from (int start_element_no) max_len = len; } m_item_width = max_len + 1; - int i = start_element_no; + + int i; + /* Mark register windows above the visible area. */ + for (i = 0; i < start_element_no; i++) + m_regs_content[i].y = 0; m_regs_column_count = (width - 2) / m_item_width; if (m_regs_column_count == 0) @@ -307,6 +311,10 @@ tui_data_window::display_registers_from (int start_element_no) cur_y++; /* Next row. */ } + /* Mark register windows below the visible area. */ + for (; i < m_regs_content.size (); i++) + m_regs_content[i].y = 0; + refresh_window (); } @@ -470,7 +478,9 @@ tui_data_window::check_register_values (struct frame_info *frame) data_item_win.regno, &data_item_win.highlight); - if (data_item_win.highlight || was_hilighted) + /* Register windows whose y == 0 are outside the visible area. */ + if ((data_item_win.highlight || was_hilighted) + && data_item_win.y > 0) data_item_win.rerender (handle.get (), m_item_width); } }