[LyX/master] Row breaking: keep unused tail for later (instead of assertion)

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Jan 6 14:08:44 UTC 2023


commit 9dd716da3ace5f81f9fc16b2cee64119f0db65e8
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Jan 6 16:02:29 2023 +0100

    Row breaking: keep unused tail for later (instead of assertion)
    
    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 |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index f58efa7..2dea92b 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -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);
 		}


More information about the lyx-cvs mailing list