The branch, scroll-reloaded, has been updated.

- Log -----------------------------------------------------------------

commit 14ba5154aa10a7e0f7977e17f3b66483727644d1
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Sun Jul 27 17:30:57 2014 +0200

    Fix some display glitches
    
    * When doing a redraw with drawing disabled (to set inset positions 
properly), take horizontal scroll offset in account
    
    * reset horizontal scroll offset when it is smaller than the left margin.
    
    * when drawing a paragraph, do not modify x globally, only for the row that 
is offset.

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 6c95d8d..92ce6f6 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -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())) {
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index e41874a..ab857a5 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1807,7 +1807,7 @@ void TextMetrics::draw(PainterInfo & pi, int x, int y) 
const
 }
 
 
-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];
@@ -1847,6 +1847,7 @@ void TextMetrics::drawParagraph(PainterInfo & pi, 
pit_type pit, int x, int y) co
        for (size_t i = 0; i != nrows; ++i) {
 
                Row const & row = pm.rows()[i];
+               int row_x = x;
                if (i)
                        y += row.ascent();
 
@@ -1859,12 +1860,12 @@ void TextMetrics::drawParagraph(PainterInfo & pi, 
pit_type pit, int x, int y) co
 
                // Adapt to cursor row scroll offset if applicable.
                if (bv_->currentRowSlice() == rowSlice)
-                       x -= bv_->horizScrollOffset();
+                       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);
@@ -1903,10 +1904,10 @@ void TextMetrics::drawParagraph(PainterInfo & pi, 
pit_type pit, int x, int y) co
                // Clear background of this row if paragraph background was not
                // already cleared because of a full repaint.
                if (!pi.full_repaint && row_has_changed) {
-                       LYXERR(Debug::PAINTING, "Clear rect@(" 
-                              << max(x, 0) << ", " << y-row.ascent() << ")=" 
+                       LYXERR(Debug::PAINTING, "Clear rect@("
+                              << max(row_x, 0) << ", " << y-row.ascent() << 
")="
                               << width() << " x " << row.height());
-                       pi.pain.fillRectangle(max(x, 0), y - row.ascent(),
+                       pi.pain.fillRectangle(max(row_x, 0), y - row.ascent(),
                                width(), row.height(), pi.background_color);
                }
 

-----------------------------------------------------------------------

Summary of changes:
 src/BufferView.cpp  |    9 +++++++--
 src/TextMetrics.cpp |   13 +++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Repository for new features

Reply via email to