[v2,06/14] Move scrollok call in register window

Message ID 20240120-tui-regs-cleanup-v2-6-a3cccc6a3573@tromey.com
State New
Headers
Series Cleanups for the TUi register window |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Tom Tromey Jan. 20, 2024, 6:23 p.m. UTC
  The register window calls scrollok each time a register is written to
the window.  However, we only need to call this once, at the start of
display.  (We could actually call it just once when the window is
made, but that would involve making another method virtual or adding a
new member -- both which I think are worse than this approach.)

Tested-By: Tom de Vries <tdevries@suse.de>
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
---
 gdb/tui/tui-regs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 12301552c34..eeea03f87c1 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -236,6 +236,10 @@  tui_data_window::update_register_data (const reggroup *group,
 void
 tui_data_window::display_registers_from (int start_element_no)
 {
+  /* In case the regs window is not boxed, we'll write the last char in the
+     last line here, causing a scroll, so prevent that.  */
+  scrollok (handle.get (), FALSE);
+
   int max_len = 0;
   for (auto &&data_item_win : m_regs_content)
     {
@@ -448,10 +452,6 @@  tui_data_window::check_register_values (frame_info_ptr frame)
 void
 tui_register_info::rerender (WINDOW *handle, int field_width)
 {
-  /* In case the regs window is not boxed, we'll write the last char in the
-     last line here, causing a scroll, so prevent that.  */
-  scrollok (handle, FALSE);
-
   if (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