[Yum-devel] [PATCH 2/2] First split any equal remaining space among overflowed columns

James Antill james at and.org
Thu Mar 4 19:28:18 UTC 2010


---
 output.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/output.py b/output.py
index 27fc81c..b4513d1 100755
--- a/output.py
+++ b/output.py
@@ -408,6 +408,21 @@ class YumOutput:
                 total_width  -= diff
                 continue
 
+            overflowed_columns = 0
+            for d in xrange(0, cols):
+                if not data[d]:
+                    continue
+                overflowed_columns += 1
+            if overflowed_columns:
+                #  Split the remaining spaces among each overflowed column
+                # equally
+                norm = total_width / overflowed_columns
+                for d in xrange(0, cols):
+                    if not data[d]:
+                        continue
+                    columns[d] += norm
+                    total_width -= norm
+
             #  Split the remaining spaces among each column equally, except the
             # last one. And put the rest into the remainder column
             cols -= 1
-- 
1.6.6



More information about the Yum-devel mailing list