From: Jean-Marc Lasgouttes Date: Tue, 31 Jan 2023 23:02:35 +0000 (+0100) Subject: Fixup 0fed10e4: make sure redraw happens as needed X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1081893e972b58942db5173c51e0796427355c11;p=features.git 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. --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index fd4ad50c1c..ae0c71461a 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; }