aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-12-17 09:28:06 -0700
committerTom Tromey <tom@tromey.com>2024-02-08 12:15:39 -0700
commit76139810361c0d46d6c49f5cfd5b4897538d1ac6 (patch)
treec9bd385c71c7e2dbfd45293f404a973809662259 /gdb/tui
parent6b32381343157132e2089ba13d50524b59da106e (diff)
downloadfsf-binutils-gdb-76139810361c0d46d6c49f5cfd5b4897538d1ac6.zip
fsf-binutils-gdb-76139810361c0d46d6c49f5cfd5b4897538d1ac6.tar.gz
fsf-binutils-gdb-76139810361c0d46d6c49f5cfd5b4897538d1ac6.tar.bz2
Change tui_register_info::visible to a method
tui_register_info::visible is redundant with the fact that y==0 means that the register is not visible. This patch changes this member in favor of having a single indication of the register's visibility -- a method with the same name. This change makes it clear that delete_data_content_windows is not needed, so this is removed as well. Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-regs.c17
-rw-r--r--gdb/tui/tui-regs.h8
2 files changed, 5 insertions, 20 deletions
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index bacb23a..1230155 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -268,7 +268,6 @@ tui_data_window::display_registers_from (int start_element_no)
/* Create the window if necessary. */
m_regs_content[i].x = box_width () + (m_item_width * j);
m_regs_content[i].y = cur_y;
- m_regs_content[i].visible = true;
m_regs_content[i].rerender (handle.get (), m_item_width);
i++; /* Next register. */
}
@@ -346,23 +345,13 @@ tui_data_window::first_data_item_displayed ()
{
for (int i = 0; i < m_regs_content.size (); i++)
{
- if (m_regs_content[i].visible)
+ if (m_regs_content[i].visible ())
return i;
}
return -1;
}
-/* See tui-regs.h. */
-
-void
-tui_data_window::delete_data_content_windows ()
-{
- for (auto &win : m_regs_content)
- win.visible = false;
-}
-
-
void
tui_data_window::erase_data_content (const char *prompt)
{
@@ -400,7 +389,6 @@ tui_data_window::rerender (bool toplevel)
else
{
erase_data_content (NULL);
- delete_data_content_windows ();
display_registers_from (0);
}
}
@@ -425,7 +413,6 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
{
first_line += num_to_scroll;
erase_data_content (NULL);
- delete_data_content_windows ();
display_registers_from_line (first_line);
}
}
@@ -448,7 +435,7 @@ tui_data_window::check_register_values (frame_info_ptr frame)
/* 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.visible ())
data_item_win.rerender (handle.get (), m_item_width);
}
}
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index e7125e4..1b0eaa2 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -44,11 +44,13 @@ struct tui_register_info
void rerender (WINDOW *handle, int field_width);
+ bool visible () const
+ { return y > 0; }
+
/* Location. */
int x = 0;
int y = 0;
bool highlight = false;
- bool visible = false;
std::string content;
private:
@@ -130,10 +132,6 @@ private:
past the register area (-1) is returned. */
int first_reg_element_no_inline (int line_no) const;
- /* Delete all the item windows in the data window. This is usually
- done when the data window is scrolled. */
- void delete_data_content_windows ();
-
void erase_data_content (const char *prompt);
/* Information about each register in the current register group. */