commit d87f3eb53d72a2340cb45e82501c9f806f0c58dd
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Tue Nov 3 16:14:35 2026 +0100

    More thorough handling of NoBreak* in shortenIfNeeded
    
    Forbid the last resort break in this case.
---
 src/Row.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/Row.cpp b/src/Row.cpp
index 20864fe4d8..550071db24 100644
--- a/src/Row.cpp
+++ b/src/Row.cpp
@@ -736,8 +736,9 @@ Row::Elements Row::shortenIfNeeded(int const max_width, int 
const next_width)
                LATTEST(tail.empty());
        }
 
-       while (cit != beg && (cit->row_flags & NoBreakBefore
-                          || (cit -1)->row_flags & NoBreakAfter)) {
+       while (cit != beg
+              && (cit->row_flags & NoBreakBefore
+                  || (cit - 1)->row_flags & NoBreakAfter)) {
                // It is not possible to separate this element from the
                // previous one. (e.g. VIRTUAL)
                --cit;
@@ -766,7 +767,10 @@ Row::Elements Row::shortenIfNeeded(int const max_width, 
int const next_width)
        }
 
        // cit == beg; remove all elements after the first one.
-       moveElements(elements_, cit + 1, tail);
+       if (cit != end
+            && !(cit->row_flags & NoBreakAfter)
+            && !((cit + 1)->row_flags & NoBreakBefore))
+               moveElements(elements_, cit + 1, tail);
        return tail;
 }
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to