[LyX/master] Fix line breaking at trailing space

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Sep 23 15:45:33 UTC 2022


commit bbaebd15ce5e67d7c6747359ae2d07a3d24bf5da
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Sep 23 18:31:10 2022 +0200

    Fix line breaking at trailing space
    
    With a string like "abc def [inset]", it should be possible to break
    between the "def" and the inset. A case of interest is when "abc def "
    is too long, but "abc def" is not.
    
    To this end, tweak the test that look whether breaking was successful:
    the right width to look at is nscp_width, the width without the final
    space.
---
 src/Row.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/Row.cpp b/src/Row.cpp
index 418e0c6..1c17fb2 100644
--- a/src/Row.cpp
+++ b/src/Row.cpp
@@ -144,7 +144,7 @@ bool Row::Element::splitAt(int const width, int next_width, bool force,
                                                 isRTL(), wrap_any | force);
 
 	// if breaking did not really work, give up
-	if (!force && breaks.front().wid > width) {
+	if (!force && breaks.front().nspc_wid > width) {
 		if (dim.wid == 0)
 			dim.wid = fm.width(str);
 		return false;


More information about the lyx-cvs mailing list