From b87a81c39477ea86499f67db31003dbb1b3f76d1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 10 Mar 2021 10:42:24 +0100 Subject: [PATCH] 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 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 595a304a72..730f0e50da 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); -- 2.39.5