lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 6076b33 10/12: Simplify code; rewrite documen


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 6076b33 10/12: Simplify code; rewrite documentation
Date: Tue, 22 May 2018 17:09:22 -0400 (EDT)

branch: master
commit 6076b33a85ccd277636036f3ba8d4175bcb02206
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Simplify code; rewrite documentation
---
 wx_table_generator.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index c3b12eb..f54a0a9 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -27,6 +27,8 @@
 #include "assert_lmi.hpp"
 #include "miscellany.hpp"               // count_newlines(), split_into_lines()
 
+#include <algorithm>                    // max()
+
 // Is this a struct only because we want its members to be publicly
 // accessible? But their values can also be changed by clients, and
 // isn't that undesirable?
@@ -323,17 +325,15 @@ LMI_ASSERT(std::size_t(h / lh) == 1u + 
count_newlines(z.header));
             {
             case oe_inelastic:
                 {
-LMI_ASSERT(!z.widest_text.empty()); // To be removed in the next commit.
-                width = dc_.GetTextExtent(z.widest_text).x;
-                // Also increase the column width to be sufficiently wide to 
fit
-                // this header line if it is inelastic.
-                increase_to_if_smaller(width, w);
+                // Greater of header width and 'widest_text' width.
+                width = std::max(w, dc_.GetTextExtent(z.widest_text).x);
+                // PDF !! Reconsider whether margin should be added here,
+                // because compute_column_widths() may need to remove it.
                 width += 2 * column_margin();
                 }
                 break;
             case oe_elastic:
                 {
-LMI_ASSERT(z.widest_text.empty()); // To be removed in the next commit.
                 // Set width to the special value of 0 for the elastic columns.
                 width = 0;
                 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]