public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/tui] Handle shared border in fixed-sized layout
@ 2023-12-09 13:44 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-12-09 13:44 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2540e3a87edcb734ef448c3a68ac4827e298f76f

commit 2540e3a87edcb734ef448c3a68ac4827e298f76f
Author: Tom de Vries <tdevries@suse.de>
Date:   Sat Dec 9 14:44:49 2023 +0100

    [gdb/tui] Handle shared border in fixed-sized layout
    
    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.
    
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 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 a4cb5a8b7bf..bb539498969 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -855,21 +855,27 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
 	  continue;
 	}
 
+      /* Two adjacent boxed windows will share a border.  */
+      if (prev != -1
+	  && m_splits[prev].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 (prev != -1
-	  && m_splits[prev].layout->last_edge_has_border_p ()
-	  && m_splits[i].layout->first_edge_has_border_p ())
-	info[i].share_box = true;
-
       prev = i;
     }
 
@@ -900,7 +906,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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-09 13:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-09 13:44 [binutils-gdb] [gdb/tui] Handle shared border in fixed-sized layout 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).