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.
This commit is contained in:
Jean-Marc Lasgouttes 2022-09-23 18:31:10 +02:00
parent 3bba2ad150
commit bbaebd15ce

View File

@ -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;