]> git.lyx.org Git - features.git/commitdiff
Row breaking: keep unused tail for later (instead of assertion)
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 6 Jan 2023 15:02:29 +0000 (16:02 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 6 Jan 2023 15:02:29 +0000 (16:02 +0100)
Instead of asserting when there are unprocessed row elements (which,
as I understand it, should almost never happen), play safe and keep
them for later processing.

Related to bug #12617.

src/TextMetrics.cpp

index f58efa794beeee18760483f49f2cb402f745a4f2..2dea92bbff3befd3102eb48a02b61572710830c8 100644 (file)
@@ -1131,7 +1131,9 @@ RowList TextMetrics::breakParagraph(Row const & bigrow) const
                rb.push_back(elt);
                rb.finalizeLast();
                if (rb.width() > width) {
-                       LATTEST(tail.empty());
+                       // Keep the tail for later; this ought to be rare, but play safe.
+                       if (!tail.empty())
+                               fcit.put(tail);
                        // if the row is too large, try to cut at last separator.
                        tail = rb.shortenIfNeeded(width, next_width);
                }