commit b2912339d06b403b95351f1d00366da13fbdc4f6
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Mon Apr 5 19:07:15 2021 +0200

    Fix drawing of indicators for tracked changes and horizontal scrolling.
    
    1/ fix horizontal position of the insets
    
       This is adapted from parts of racoon's patch for bug #12131.
    
    2/ fix height of the indicators when at the top or bottom of document,
       by using the row's contents_dim() to measure is height.
    
    3/ fix partial blinking of horizontl scrolling marks when editing table.
    
    Fixes bug #12171.
---
 src/RowPainter.cpp  |   26 ++++++++++++++------------
 src/TextMetrics.cpp |    8 ++++++--
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index 8cc7202..07913c7 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -289,7 +289,10 @@ void RowPainter::paintChange(Row::Element const & e) const
 
 void RowPainter::paintChangeBar() const
 {
-       pi_.pain.fillRectangle(5, yo_ - row_.ascent(), 3, row_.height(), 
Color_changebar);
+       int const x = pi_.base.bv->leftMargin() - pi_.base.bv->zoomedPixels(7);
+       Dimension const & cdim = row_.contents_dim();
+       pi_.pain.fillRectangle(x, yo_ - cdim.ascent(),
+                              3, cdim.height(), Color_changebar);
 }
 
 
@@ -378,18 +381,17 @@ void RowPainter::paintAppendixStart(int y) const
 
 void RowPainter::paintTooLargeMarks(bool const left, bool const right) const
 {
-       if (left)
-               pi_.pain.line(pi_.base.dottedLineThickness(), yo_ - 
row_.ascent(),
-                                         pi_.base.dottedLineThickness(), yo_ + 
row_.descent(),
-                                         Color_scroll, Painter::line_onoffdash,
-                             pi_.base.dottedLineThickness());
+       int const lwid = pi_.base.dottedLineThickness();
+       Dimension const & cdim = row_.contents_dim();
+       if (left) {
+               int const x = pi_.base.bv->leftMargin() - lwid;
+               pi_.pain.line(x, yo_ - cdim.ascent(), x, yo_ + cdim.descent(),
+                             Color_scroll, Painter::line_onoffdash, lwid);
+       }
        if (right) {
-               int const wwidth =
-                       pi_.base.bv->workWidth() - 
pi_.base.dottedLineThickness();
-               pi_.pain.line(wwidth, yo_ - row_.ascent(),
-                                         wwidth, yo_ + row_.descent(),
-                                         Color_scroll, Painter::line_onoffdash,
-                             pi_.base.dottedLineThickness());
+               int const x = pi_.base.bv->workWidth() - 
pi_.base.bv->rightMargin();
+               pi_.pain.line(x, yo_ - cdim.ascent(), x, yo_ + cdim.descent(),
+                             Color_scroll, Painter::line_onoffdash, lwid);
        }
 }
 
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index e95757c..1ee6a51 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1905,6 +1905,9 @@ void TextMetrics::drawParagraph(PainterInfo & pi, 
pit_type const pit, int const
                        // Paint only the insets if the text itself is
                        // unchanged.
                        rp.paintOnlyInsets();
+                       rp.paintTooLargeMarks(
+                               row_x + row.left_x() < bv_->leftMargin(),
+                               row_x + row.right_x() > bv_->workWidth() - 
bv_->rightMargin());
                        row.changed(false);
                        y += row.descent();
                        continue;
@@ -1947,8 +1950,9 @@ void TextMetrics::drawParagraph(PainterInfo & pi, 
pit_type const pit, int const
                if (i == nrows - 1)
                        rp.paintLast();
                rp.paintText();
-               rp.paintTooLargeMarks(row_x + row.left_x() < 0,
-                                     row_x + row.right_x() > bv_->workWidth());
+               rp.paintTooLargeMarks(
+                       row_x + row.left_x() < bv_->leftMargin(),
+                       row_x + row.right_x() > bv_->workWidth() - 
bv_->rightMargin());
                // indicate bookmarks presence in margin
                for (auto const & bp_p : bpl)
                        if (bp_p.second >= row.pos() && bp_p.second < 
row.endpos())
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to