public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/tui] Handle shared border in fixed-sized layout
@ 2023-11-10 16:54 Tom de Vries
  2023-12-08 15:57 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2023-11-10 16:54 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-09 13:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-10 16:54 [PATCH] [gdb/tui] Handle shared border in fixed-sized layout Tom de Vries
2023-12-08 15:57 ` Tom Tromey
2023-12-09 13:47   ` Tom de Vries

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).