commit 677a2c2cd14d4e607648be41c9b90b42eda9a764
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Wed Feb 28 11:27:52 2024 +0100

    Fixup 71d9f6e9: swap two tests to avoid line breaking issues
    
    The new approach to line breaking introduced in 71d9f6e9 is correct,
    but the newly introduced min_row_wid should not be updated when the
    remaining line width after a break is larger than next_width.
    
    Swapping the two tests fixes remaining issues.
    
    Fixes (for good?) #12899.
---
 src/Row.cpp | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/Row.cpp b/src/Row.cpp
index 20a05c3bae..86b4e5014c 100644
--- a/src/Row.cpp
+++ b/src/Row.cpp
@@ -605,14 +605,6 @@ Row::Elements Row::shortenIfNeeded(int const max_width, 
int const next_width)
                 */
                int const split_width =  min(max_width - wid_brk, brk.dim.wid - 
2);
                if (brk.splitAt(split_width, next_width, BEST_EFFORT, tail)) {
-                       // if we did not manage to fit a part of the element 
into
-                       // the split_width limit, at least remember that we can
-                       // shorten the row if needed.
-                       if (brk.dim.wid > split_width) {
-                               min_row_wid = wid_brk + brk.dim.wid;
-                               tail.clear();
-                               continue;
-                       }
                        /* if this element originally did not cause a row 
overflow
                         * in itself, and the remainder of the row would still 
be
                         * too large after breaking, then we will have issues in
@@ -623,6 +615,15 @@ Row::Elements Row::shortenIfNeeded(int const max_width, 
int const next_width)
                                tail.clear();
                                break;
                        }
+                       /* if we did not manage to fit a part of the element 
into
+                        * the split_width limit, at least remember that we can
+                        * shorten the row if needed.
+                        */
+                       if (brk.dim.wid > split_width) {
+                               min_row_wid = wid_brk + brk.dim.wid;
+                               tail.clear();
+                               continue;
+                       }
                        // We have found a proper place where to break this 
string element.
                        end_ = brk.endpos;
                        *cit_brk = brk;
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to