commit 6f7505300ed7b4bd1f78bea076b6469e7e9cc32d
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Mon Jan 17 15:14:05 2022 +0100

    When clearing a row, always clear the whole text area width
    
    It is not a good idea to take into account the horizontal scrolling
    that may have happened. For example, this leads to display glitches
    when a Description label is larger than text width.
    
    This explains why SingleParUpdate strategy did not work with home/end
    on a long row.
---
 src/BufferView.cpp  |   11 ++++-------
 src/TextMetrics.cpp |    4 ++--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 25b33b9..2bf7d2a 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -3391,15 +3391,12 @@ void BufferView::checkCursorScrollOffset()
 
        //lyxerr << "cur_x=" << cur_x << ", offset=" << offset << ", row.wid=" 
<< row.width() << ", margin=" << MARGIN << endl;
 
-       if (offset != d->horiz_scroll_offset_)
+       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_) {
-               // FIXME: if one uses SingleParUpdate, then home/end
-               // will not work on long rows. Why?
-               d->update_strategy_ = FullScreenUpdate;
+               row.changed(true);
+               if (d->update_strategy_ == NoScreenUpdate)
+                       d->update_strategy_ = SingleParUpdate;
        }
 
        d->horiz_scroll_offset_ = offset;
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index f227164..19a5e8f 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -2039,9 +2039,9 @@ void TextMetrics::drawParagraph(PainterInfo & pi, 
pit_type const pit, int const
                // already cleared because of a full repaint.
                if (!pi.full_repaint && row.changed()) {
                        LYXERR(Debug::PAINTING, "Clear rect@("
-                              << max(row_x, 0) << ", " << y - row.ascent() << 
")="
+                              << x << ", " << y - row.ascent() << ")="
                               << width() << " x " << row.height());
-                       pi.pain.fillRectangle(row_x, y - row.ascent(),
+                       pi.pain.fillRectangle(x, y - row.ascent(),
                                              width(), row.height(), 
pi.background_color);
                }
 
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to