* breakRow: remove wrong condition that would silently eat the contents of the
paragraph when the window is narrower than left margin
* breakRow: make sure that there is at least one element in each row
* breakAt: when force-breaking a row element, make sure it is not empty. Doing
so may create empty rows and therefore a endless loop.
Fixes bugs #9962 and #10001.
// the width available for the row.
int const width = max_width_ - row.right_margin;
- if (pos >= end || row.width() > width) {
+ if (pos >= end) {
row.endpos(end);
return;
}
// or the end of the par, then build a representation of the row.
pos_type i = pos;
FontIterator fi = FontIterator(*this, par, pit, pos);
- while (i < end && row.width() <= width) {
+ do {
char_type c = par.getChar(i);
// The most special cases are handled first.
if (par.isInset(i)) {
++i;
++fi;
- }
+ } while (i < end && row.width() <= width);
row.finalizeLast();
row.endpos(i);
line.setLineWidth(x);
tl.createLine();
tl.endLayout();
- if (int(line.naturalTextWidth()) > x)
+ if ((force && line.textLength() == 1) || int(line.naturalTextWidth()) > x)
return false;
x = int(line.naturalTextWidth());
// The -1 is here to account for the leading zerow_nbsp.