public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/tui] Use more box_width in tui-regs.c Date: Sat, 16 Dec 2023 08:23:17 +0000 (GMT) [thread overview] Message-ID: <20231216082317.7EC753858D32@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bebb0dd44b98f5b6555cb75389b7b14deed9550e commit bebb0dd44b98f5b6555cb75389b7b14deed9550e Author: Tom de Vries <tdevries@suse.de> Date: Sat Dec 16 09:23:38 2023 +0100 [gdb/tui] Use more box_width in tui-regs.c While experimenting with can_box () == false by default, I noticed two places in tui-regs.c where we can replace a hardcoded 1 with box_width (). It also turned out to be necessary to set scrollok to false, otherwise writing the last char of the last line with register info will cause a scroll. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> Diff: --- gdb/tui/tui-regs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 4c6ea8aff0d..ba801ddc050 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -288,7 +288,7 @@ tui_data_window::display_registers_from (int start_element_no) /* Now create each data "sub" window, and write the display into it. */ - int cur_y = 1; + int cur_y = box_width (); while (i < m_regs_content.size () && cur_y <= height - box_size ()) { for (int j = 0; @@ -296,7 +296,7 @@ tui_data_window::display_registers_from (int start_element_no) j++) { /* Create the window if necessary. */ - m_regs_content[i].x = (m_item_width * j) + 1; + 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); @@ -487,6 +487,10 @@ tui_data_window::check_register_values (frame_info_ptr frame) void tui_data_item_window::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
reply other threads:[~2023-12-16 8:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231216082317.7EC753858D32@sourceware.org \ --to=vries@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).