From: Tom Tromey Date: Sun, 17 Dec 2023 16:31:05 +0000 (-0700) Subject: Move scrollok call in register window X-Git-Tag: gdb-15-branchpoint~1027 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=074b58b4dcbc395633f3bcfa1e4c990e0d942e8e;p=thirdparty%2Fbinutils-gdb.git Move scrollok call in register window 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 Reviewed-By: Andrew Burgess Approved-By: Andrew Burgess --- 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