]> git.lyx.org Git - features.git/commitdiff
Avoid making tabular too large when using a caption in longtable mode
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 28 Jan 2016 13:27:05 +0000 (14:27 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 29 Jan 2016 09:05:48 +0000 (10:05 +0100)
This is a fixup to commit cdb9f043, which fixed bug #9757.

It is necessary to make a special case for inserting an InsetCaption
in a tabular cell, because this commonly happens in longtable mode.

Fixes bug #9945.

src/TextMetrics.cpp

index 325fb6c21d48d1c9e32be755249f207f3e8df158..cb1c4bd2bd16c98095c1060d2ee7ee19627e4ff4 100644 (file)
@@ -447,11 +447,17 @@ bool TextMetrics::redoParagraph(pit_type const pit)
                breakRow(row, right_margin, pit);
                setRowHeight(row, pit);
                row.setChanged(false);
-               if (row_index || row.right_boundary() || row.endpos() < par.size())
-                       // 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.
+               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).
+                        */
                        dim_.wid = max_width_;
                int const max_row_width = max(dim_.wid, row.width());
                computeRowMetrics(pit, row, max_row_width);