+ /* We have found a suitable separable element. This is the common case.
+ * Try to break it cleanly (at word boundary) at a length that is both
+ * - less than the available space on the row
+ * - shorter than the natural width of the element, in order to enforce
+ * break-up.
+ */
+ if (last_brk != end
+ && last_brk->breakAt(min(w - last_wid, last_brk->dim.wid - 2), false)) {
+ end_ = last_brk->endpos;
+ /* after breakAt, there may be spaces at the end of the
+ * string, but they are not counted in the string length
+ * (QTextLayout feature, actually). We remove them, but do not
+ * change the endo of the row, since the spaces at row break
+ * are invisible.
+ */
+ last_brk->str = rtrim(last_brk->str);
+ last_brk->endpos = last_brk->pos + last_brk->str.length();
+ dim_.wid = last_wid + last_brk->dim.wid;
+ // If there are other elements, they should be removed.
+ elements_.erase(next(last_brk, 1), end);
+ return;
+ }
+