]> git.lyx.org Git - features.git/blobdiff - src/BufferView.cpp
Fix some display glitches
[features.git] / src / BufferView.cpp
index 6c95d8df833d2836c2f1cd8a26e3dbc375dca833..92ce6f634de6f9b5ccfdebd5bfe7f2c56593af6d 100644 (file)
@@ -2929,7 +2929,8 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi)
        bool const drawing = pi.pain.isDrawingEnabled();
        pi.pain.setDrawingEnabled(false);
        // No need to care about vertical position.
-       RowPainter rp(pi, buffer().text(), d->cursor_.bottom().pit(), row, 0, 0);
+       RowPainter rp(pi, buffer().text(), d->cursor_.bottom().pit(), row,
+                     -d->horiz_scroll_offset_, 0);
        rp.paintText();
        pi.pain.setDrawingEnabled(drawing);
 
@@ -2947,9 +2948,13 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi)
                offset = cur_x - workWidth() + MARGIN;
        }
 
-       if (offset < 0 || row.width() <= workWidth())
+       if (offset < row.x || row.width() <= workWidth())
                offset = 0;
 
+       if (offset != d->horiz_scroll_offset_)
+               LYXERR(Debug::PAINTING, "Horiz. scroll offset changed from "
+                      << d->horiz_scroll_offset_ << " to " << offset);
+
        if (d->update_strategy_ == NoScreenUpdate
            && (offset != d->horiz_scroll_offset_
                || !d->last_row_slice_.empty())) {