+ // Allow setting of refreshInside for nested insets in
+ // this row only
+ bool tmp = refreshInside;
+
+ // Row signature; has row changed since last paint?
+ bool row_has_changed = pm.rowChangeStatus()[rowno];
+
+ bool cursor_on_row = CursorOnRow(pi, pit, rit, text);
+ bool in_inset_alone_on_row = innerCursorOnRow(pi, pit, rit,
+ text);
+ bool leftEdgeFixed =
+ (par.getAlign() == LYX_ALIGN_LEFT ||
+ par.getAlign() == LYX_ALIGN_BLOCK);
+
+ // If this is the only object on the row, we can make it wide
+ //
+ // FIXME: there is a const_cast here because paintPar() is not supposed
+ // to touch the paragraph contents. So either we move this "wide"
+ // property out of InsetText or we localize the feature to the painting
+ // done here.
+ for (pos_type i = rit->pos() ; i != rit->endpos(); ++i) {
+ InsetBase const * const in = par.getInset(i);
+ if (in) {
+ InsetText * t = const_cast<InsetText *>(in->asTextInset());
+ if (t)
+ t->setWide(in_inset_alone_on_row && leftEdgeFixed);
+ }
+ }
+
+ // If selection is on, the current row signature differs
+ // from cache, or cursor is inside an inset _on this row_,
+ // then paint the row
+ if (repaintAll || row_has_changed || cursor_on_row) {
+ bool const inside = (y + rit->descent() >= 0
+ && y - rit->ascent() < ww);
+ // it is not needed to draw on screen if we are not inside.
+ pi.pain.setDrawingEnabled(inside);
+ RowPainter rp(pi, text, pit, *rit, x, y);
+ // Clear background of this row
+ // (if paragraph background was not cleared)
+ if (!repaintAll &&
+ (!(in_inset_alone_on_row && leftEdgeFixed)
+ || row_has_changed)) {
+ pi.pain.fillRectangle(x, y - rit->ascent(),
+ rp.maxWidth(), rit->height(),
+ text.backgroundColor());
+ // If outer row has changed, force nested
+ // insets to repaint completely
+ if (row_has_changed)
+ refreshInside = true;
+ }