public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] [gdb/tui] Don't include border_width in left_margin
Date: Fri, 10 Nov 2023 14:00:51 +0100	[thread overview]
Message-ID: <20231110130051.21239-3-tdevries@suse.de> (raw)
In-Reply-To: <20231110130051.21239-1-tdevries@suse.de>

Currently left_margin does not match its documentation:
...
  /* Return the size of the left margin space, this is the space used to
     display things like breakpoint markers.  */
  int left_margin () const
  { return box_width () + TUI_EXECINFO_SIZE + extra_margin (); }
...

It is stated that the left margin is reserved to display things, but
the box_width is not used for that.

Fix this by dropping box_width () from the left_margin calculation.

Tested on x86_64-linux.
---
 gdb/tui/tui-winsource.c | 2 +-
 gdb/tui/tui-winsource.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 83ce48090a0..ea4ca219292 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -348,7 +348,7 @@ tui_source_window_base::refresh_window ()
   gdb_assert (pad_x + view_width <= pad_width || m_pad.get () == nullptr);
 
   int sminrow = y + box_width ();
-  int smincol = x + left_margin;
+  int smincol = x + box_width () + left_margin;
   int smaxrow = sminrow + m_content.size () - 1;
   int smaxcol = smincol + view_width - 1;
   prefresh (m_pad.get (), 0, pad_x, sminrow, smincol, smaxrow, smaxcol);
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index dccce0efca1..c2826165a10 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -206,13 +206,13 @@ struct tui_source_window_base : public tui_win_info
   /* Return the size of the left margin space, this is the space used to
      display things like breakpoint markers.  */
   int left_margin () const
-  { return box_width () + TUI_EXECINFO_SIZE + extra_margin (); }
+  { return TUI_EXECINFO_SIZE + extra_margin (); }
 
   /* Return the width of the area that is available for window content.
      This is the window width minus the borders and the left margin, which
      is used for displaying things like breakpoint markers.  */
   int view_width () const
-  { return width - left_margin () - box_width (); }
+  { return width - left_margin () - box_size (); }
 
   void show_source_content ();
 
-- 
2.35.3


  parent reply	other threads:[~2023-11-10 12:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 13:00 [PATCH 1/3] [gdb/tui] Refactor prefresh call in tui_source_window_base::refresh_window Tom de Vries
2023-11-10 13:00 ` [PATCH 2/3] [gdb/tui] Add tui_win_info::{box_width,box_size} Tom de Vries
2023-11-13 17:42   ` Tom Tromey
2023-11-10 13:00 ` Tom de Vries [this message]
2023-11-13 17:42   ` [PATCH 3/3] [gdb/tui] Don't include border_width in left_margin Tom Tromey
2023-11-13 17:41 ` [PATCH 1/3] [gdb/tui] Refactor prefresh call in tui_source_window_base::refresh_window Tom Tromey

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=20231110130051.21239-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@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: link
Be 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).