]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/tui] Handle shared border in fixed-sized layout
authorTom de Vries <tdevries@suse.de>
Sat, 9 Dec 2023 13:44:49 +0000 (14:44 +0100)
committerTom de Vries <tdevries@suse.de>
Sat, 9 Dec 2023 13:44:49 +0000 (14:44 +0100)
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>
gdb/tui/tui-layout.c

index a4cb5a8b7bf6ccd51ef70ade0964d3f24fdbcbc6..bb539498969d8a171f4e3194f31e63f1d3012292 100644 (file)
@@ -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;