commit b87a81c39477ea86499f67db31003dbb1b3f76d1
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Wed Mar 10 10:42:24 2021 +0100

    Fixup fbf22bb3: really avoid screen-jumping with mouse click.
    
    It turns out that the commit from gadmm's lyx-unstable has been
    cherry-picked at the wrong place! However I believe that both changes
    are necessary.
    
    With this second patch, I do see that some screen jumping is avoided.
    
    Fixes bug #7457.
---
 src/BufferView.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 595a304..730f0e5 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1015,10 +1015,11 @@ bool BufferView::scrollToCursor(DocIterator const & 
dit, bool const recenter)
                LBUFERR(!pm.rows().empty());
                // FIXME: smooth scrolling doesn't work in mathed.
                CursorSlice const & cs = dit.innerTextSlice();
-               int offset = coordOffset(dit).y_;
-               int ypos = pm.position() + offset;
+               int const ypos = pm.position() + coordOffset(dit).y_;
+               ParagraphMetrics const & inner_pm =
+                       textMetrics(cs.text()).parMetrics(cs.pit());
                Dimension const & row_dim =
-                       pm.getRow(cs.pos(), dit.boundary()).dim();
+                       inner_pm.getRow(cs.pos(), dit.boundary()).dim();
                int scrolled = 0;
                if (recenter)
                        scrolled = scroll(ypos - height_/2);
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to