commit 1081893e972b58942db5173c51e0796427355c11
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Wed Feb 1 00:02:35 2023 +0100

    Fixup 0fed10e4: make sure redraw happens as needed
    
    This commit had had an additional not documented change: redraws
    happen only when they are needed. This did not help fix the bug, but
    looked smart on first sight. Alas, I find that these smart changes
    added because "why not?" tend to come back to haunt me eventually.
    
    In particular this case, the problem was that the code tested whether
    the offset of anchor paragraph had changed, but not whether the
    paragraph itself had changed. This means that, when switching from one
    section to another with the outliner, the view was not updated.
---
 src/BufferView.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index fd4ad50..ae0c714 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1064,6 +1064,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, 
ScrollType how)
 
        tm.redoParagraph(bot_pit);
        int const offset = coordOffset(dit).y_;
+       pit_type const old_pit = d->anchor_pit_;
        d->anchor_pit_ = bot_pit;
 
        CursorSlice const & cs = dit.innerTextSlice();
@@ -1076,7 +1077,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, 
ScrollType how)
        d->anchor_ypos_ = - offset + row_dim.ascent();
        if (how == SCROLL_CENTER)
                d->anchor_ypos_ += height_/2 - row_dim.height() / 2;
-       return d->anchor_ypos_ != old_ypos;
+       return d->anchor_ypos_ != old_ypos || d->anchor_pit_ != old_pit;
 }
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to