From 6c98ac5a7b63606333672969b7b23cbc42f6b57d Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 23 Jan 2022 20:55:18 +0100 Subject: [PATCH] Fix breaking of MANUAL_LABEL paragraph when label is too long Typical example is a Labeling layout which label is an inline equation larger than the screen. Before this commit, the row would not get broken at all. Two parts in the patch: 1/ when breaking the row in shortenIfNeeded, mark the last element as AlwaysBreakAfter instead of BreakAfter, in case the next element is NoBreakBefore. 2/ when nothing could be done, as last resort keep the first element of the row only. --- src/Row.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Row.cpp b/src/Row.cpp index d1921a6d3f..f2d4aafe85 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -537,7 +537,7 @@ void moveElements(Row::Elements & from, Row::Elements::iterator const & it, to.insert(to.end(), it, from.end()); from.erase(it, from.end()); if (!from.empty()) - from.back().row_flags = (from.back().row_flags & ~AfterFlags) | BreakAfter; + from.back().row_flags = (from.back().row_flags & ~AfterFlags) | AlwaysBreakAfter; } } @@ -645,7 +645,9 @@ Row::Elements Row::shortenIfNeeded(int const w, int const next_width) return tail; } - return Elements(); + // cit == beg; remove all elements after the first one. + moveElements(elements_, cit + 1, tail); + return tail; } -- 2.39.2