Paragraph const & par = text_->getPar(pit);
- double const w = width - row.right_margin - row.width();
+ int const w = width - row.right_margin - row.width();
// FIXME: put back this assertion when the crash on new doc is solved.
//LASSERT(w >= 0, /**/);
// are there any hfills in the row?
if (int const nh = numberOfHfills(row, par.beginOfBody())) {
if (w > 0)
- hfill = w / double(nh);
+ hfill = double(w) / nh;
// we don't have to look at the alignment if it is ALIGN_LEFT and
// if the row is already larger then the permitted width as then
// we force the LEFT_ALIGN'edness!
* or newline, then stretch it */
if (ns && !row.right_boundary()
&& row.endpos() != par.size()) {
- setSeparatorWidth(row, w / ns);
+ setSeparatorWidth(row, double(w) / ns);
row.dimension().wid = width;
} else if (is_rtl) {
row.dimension().wid = width;
row.left_margin += w;
break;
case LYX_ALIGN_CENTER:
- row.dimension().wid = width - int(w / 2);
+ row.dimension().wid = width - w / 2;
row.left_margin += w / 2;
break;
case LYX_ALIGN_LEFT:
}
-void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) const
+void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const x, int y) const
{
BufferParams const & bparams = bv_->buffer().params();
ParagraphMetrics const & pm = par_metrics_[pit];
for (size_t i = 0; i != nrows; ++i) {
Row const & row = pm.rows()[i];
+ int row_x = x;
if (i)
y += row.ascent();
+ CursorSlice rowSlice(const_cast<InsetText &>(text_->inset()));
+ rowSlice.pit() = pit;
+ rowSlice.pos() = row.pos();
+
bool const inside = (y + row.descent() >= 0
&& y - row.ascent() < ww);
+
+ // Adapt to cursor row scroll offset if applicable.
+ if (bv_->currentRowSlice() == rowSlice)
+ row_x -= bv_->horizScrollOffset();
+
// It is not needed to draw on screen if we are not inside.
pi.pain.setDrawingEnabled(inside && original_drawing_state);
- RowPainter rp(pi, *text_, pit, row, x, y);
+
+ RowPainter rp(pi, *text_, pit, row, row_x, y);
if (selection)
row.setSelectionAndMargins(sel_beg_par, sel_end_par);
// Row signature; has row changed since last paint?
row.setCrc(pm.computeRowSignature(row, bparams));
- bool row_has_changed = row.changed();
+ bool row_has_changed = row.changed()
+ || rowSlice == bv_->lastRowSlice();
// Take this opportunity to spellcheck the row contents.
if (row_has_changed && lyxrc.spellcheck_continuously) {
// Clear background of this row if paragraph background was not
// already cleared because of a full repaint.
if (!pi.full_repaint && row_has_changed) {
- pi.pain.fillRectangle(x, y - row.ascent(),
+ LYXERR(Debug::PAINTING, "Clear rect@("
+ << max(row_x, 0) << ", " << y - row.ascent() << ")="
+ << width() << " x " << row.height());
+ pi.pain.fillRectangle(max(row_x, 0), y - row.ascent(),
width(), row.height(), pi.background_color);
}
rp.paintLast();
if (i == 0 && is_rtl)
rp.paintFirst();
+ rp.paintTooLargeMarks(row_x < 0,
+ row_x + row.width() > bv_->workWidth());
y += row.descent();
// Restore full_repaint status.