[meld] diffgrid: Ignore natural width when doing minimum width calculations



commit 3390227ebb9dd1e9ea3573dc8b8f3447908d6f4a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Apr 23 08:30:28 2017 +1000

    diffgrid: Ignore natural width when doing minimum width calculations
    
    Ideally we'd be doing real calculations here, but we're not and this
    works for now. The logic here is explained in the comment, but really
    we're just trying to return a sane minimum width to avoid widgets
    (realistically, just labels) that have a very large natural width but
    support height-for-width geometry.
    
    One user-visible bug caused by this is that when a long-highlighting
    warning appears (which has a lot of text in a label), resizing panes
    while it's visible chooses very large minimum sizes and breaks.

 meld/diffgrid.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/meld/diffgrid.py b/meld/diffgrid.py
index 71ee7b5..dd96b9c 100644
--- a/meld/diffgrid.py
+++ b/meld/diffgrid.py
@@ -211,8 +211,14 @@ class DiffGrid(Gtk.Grid):
                     spanning = GObject.Value(int)
                     self.child_get_property(child, 'width', spanning)
                     spanning = spanning.get_int()
+                    # We ignore natural size when calculating required
+                    # width, but use it when doing required height. The
+                    # logic here is that height-for-width means that
+                    # minimum width requisitions mean more-than-minimum
+                    # heights. This is all extremely dodgy, but works
+                    # for now.
                     if spanning == 1:
-                        wcols[col] = max(wcols[col], msize.width, nsize.width)
+                        wcols[col] = max(wcols[col], msize.width)
                     hrows[row] = max(hrows[row], msize.height, nsize.height)
         return wcols, hrows
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]