From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH] [gdb/tui] Handle shared border in fixed-sized layout
Date: Fri, 10 Nov 2023 17:54:19 +0100 [thread overview]
Message-ID: <20231110165419.16793-1-tdevries@suse.de> (raw)
In tui_layout_split::apply I noticed that for variable-size layouts we take
share_box into account by decreasing used_size:
...
used_size += info[i].size;
if (info[i].share_box)
--used_size;
...
but not for fixed-size layouts:
...
if (info[i].min_size == info[i].max_size)
available_size -= info[i].min_size;
...
Fix this by increasing available_size for fixed-size layouts with shared box.
Tested on x86_64-linux.
---
gdb/tui/tui-layout.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 159445dc520..0edc225b0d8 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -864,20 +864,26 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
info[i].max_size = info[i].min_size;
}
+ /* Two adjacent boxed windows will share a border. */
+ if (i > 0
+ && m_splits[i - 1].layout->last_edge_has_border_p ()
+ && m_splits[i].layout->first_edge_has_border_p ())
+ info[i].share_box = true;
+
if (info[i].min_size == info[i].max_size)
- available_size -= info[i].min_size;
+ {
+ available_size -= info[i].min_size;
+ if (info[i].share_box)
+ {
+ /* A shared border makes a bit more size available. */
+ ++available_size;
+ }
+ }
else
{
last_index = i;
total_weight += m_splits[i].weight;
}
-
- /* Two adjacent boxed windows will share a border, making a bit
- more size available. */
- if (i > 0
- && m_splits[i - 1].layout->last_edge_has_border_p ()
- && m_splits[i].layout->first_edge_has_border_p ())
- info[i].share_box = true;
}
/* If last_index is set then we have a window that is not of a fixed
@@ -907,7 +913,10 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
this function. */
used_size += info[i].size;
if (info[i].share_box)
- --used_size;
+ {
+ /* A shared border makes a bit more size available. */
+ --used_size;
+ }
}
else
info[i].size = info[i].min_size;
base-commit: e922d1eaa3774a68c96eae01e0fd08f8a30cda8c
--
2.35.3
next reply other threads:[~2023-11-10 16:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 16:54 Tom de Vries [this message]
2023-12-08 15:57 ` Tom Tromey
2023-12-09 13:47 ` Tom de Vries
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=20231110165419.16793-1-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).