commit 8318f9f995583ed67f78626238c72a430ff606da
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Wed Dec 17 17:53:38 2025 +0100
Avoid crash with weird Labeling layout paragraph
For some reason, beginOfBody is set to zero when a paragraph begins with an
environment separator inset or a newline inset.
TextMetrics::labelFill is called in layouts with both labeltype=manual
and margin=manual (basically Labeling layout). It asserts if
beginOfBody is 0 and the first character is not an environment
separator inset. Obviously, the case of a newline inset had been
forgotten.
This is really a corner case, but it has been reported in a real life
document.
(cherry picked from commit 1aea215bcf8b67c4df0362e4ab7129c60af1080b)
---
src/TextMetrics.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 57e944455f..662f9efcbe 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -854,7 +854,7 @@ void TextMetrics::setRowAlignment(Row & row, int width)
const
int TextMetrics::labelFill(Row const & row) const
{
Paragraph const & par = text_->getPar(row.pit());
- LBUFERR(par.beginOfBody() > 0 || par.isEnvSeparator(0));
+ LBUFERR(par.beginOfBody() > 0 || par.isEnvSeparator(0) ||
par.isNewline(0));
int w = 0;
// iterate over elements before main body (except the last one,
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs