commit fa9675965a1fd69b3869970593ed7645328d5fc7
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Jul 6 16:15:13 2018 +0200

    Do not expand tabular cells to maxwidth on line break
    
    Fixes part of #11182.
---
 src/TextMetrics.cpp         |   11 ++++-------
 src/insets/InsetTabular.cpp |    1 -
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 5035187..1e17028 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -469,16 +469,13 @@ bool TextMetrics::redoParagraph(pit_type const pit)
                need_new_row = breakRow(row, right_margin);
                setRowHeight(row);
                row.changed(true);
-               if (row_index || row.endpos() < par.size()
-                   || (row.right_boundary() && par.inInset().lyxCode() != 
CELL_CODE)) {
+               if ((row_index || row.endpos() < par.size() || 
row.right_boundary())
+                   && par.inInset().lyxCode() != CELL_CODE) {
                        /* If there is more than one row or the row has been
                         * broken by a display inset or a newline, expand the 
text
                         * to the full allowable width. This setting here is
-                        * needed for the computeRowMetrics() below. In the case
-                        * of a display inset, we do nothing when inside a table
-                        * cell, because the tabular code is not prepared for
-                        * that, and it triggers when using a caption in a
-                        * longtable (see bugs #9945 and #9757).
+                        * needed for the computeRowMetrics() below.
+                        * We do nothing when inside a table cell.
                         */
                        if (dim_.wid < max_width_)
                                dim_.wid = max_width_;
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index bab4b59..696458a 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -3845,7 +3845,6 @@ void InsetTableCell::metrics(MetricsInfo & mi, Dimension 
& dim) const
 
        // We tell metrics here not to expand on multiple pars
        // This is the difference to InsetText::Metrics
-       // FIXME: pars with newlines are still too wide!
        if (hasFixedWidth())
                tm.metrics(mi, dim, mi.base.textwidth, false);
        else

Reply via email to