* [PATCH] Make tui_register_info::highlight private
@ 2024-06-02 16:25 Tom Tromey
2024-06-15 23:32 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2024-06-02 16:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes tui_register_info::highlight to be private, renaming it
to m_highlight.
---
gdb/tui/tui-regs.c | 18 ++++++++----------
gdb/tui/tui-regs.h | 8 ++++++--
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 8db26918123..1796c3c55d0 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -101,13 +101,13 @@ tui_register_format (const frame_info_ptr &frame, int regnum)
}
/* Compute the register value from the given frame and format it for
- the display. update 'content' and set 'highlight' if the contents
- changed. */
+ the display. Update 'content' and set 'm_highlight' if the
+ contents changed. */
void
tui_register_info::update (const frame_info_ptr &frame)
{
std::string new_content = tui_register_format (frame, m_regno);
- highlight = content != new_content;
+ m_highlight = content != new_content;
content = std::move (new_content);
}
@@ -410,12 +410,11 @@ tui_data_window::check_register_values (const frame_info_ptr &frame)
{
for (tui_register_info &data_item_win : m_regs_content)
{
- bool was_hilighted = data_item_win.highlight;
+ bool was_hilighted = data_item_win.highlighted ();
data_item_win.update (frame);
- /* Register windows whose y == 0 are outside the visible area. */
- if ((data_item_win.highlight || was_hilighted)
+ if ((data_item_win.highlighted () || was_hilighted)
&& data_item_win.visible ())
data_item_win.rerender (handle.get (), m_item_width);
}
@@ -424,12 +423,11 @@ tui_data_window::check_register_values (const frame_info_ptr &frame)
}
}
-/* Display a register in a window. If hilite is TRUE, then the value
- will be displayed in reverse video. */
+/* Display a register in a window. */
void
tui_register_info::rerender (WINDOW *handle, int field_width)
{
- if (highlight)
+ if (m_highlight)
/* We ignore the return value, casting it to void in order to avoid
a compiler warning. The warning itself was introduced by a patch
to ncurses 5.7 dated 2009-08-29, changing this macro to expand
@@ -441,7 +439,7 @@ tui_register_info::rerender (WINDOW *handle, int field_width)
if (content.size () < field_width)
waddstr (handle, n_spaces (field_width - content.size ()));
- if (highlight)
+ if (m_highlight)
/* We ignore the return value, casting it to void in order to avoid
a compiler warning. The warning itself was introduced by a patch
to ncurses 5.7 dated 2009-08-29, changing this macro to expand
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index 07b951316b6..2436a7d3ee6 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -33,7 +33,6 @@ struct tui_register_info
: m_regno (regno)
{
update (frame);
- highlight = false;
}
DISABLE_COPY_AND_ASSIGN (tui_register_info);
@@ -47,14 +46,19 @@ struct tui_register_info
bool visible () const
{ return y > 0; }
+ bool highlighted () const
+ { return m_highlight; }
+
/* Location. */
int x = 0;
int y = 0;
- bool highlight = false;
std::string content;
private:
+ /* True if currently highlighted. */
+ bool m_highlight = false;
+
/* The register number. */
const int m_regno;
};
--
2.44.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-15 23:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-02 16:25 [PATCH] Make tui_register_info::highlight private Tom Tromey
2024-06-15 23:32 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).