From 1081893e972b58942db5173c51e0796427355c11 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 1 Feb 2023 00:02:35 +0100 Subject: [PATCH] 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 file changed, 2 insertions(+), 1 deletion(-) 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; } -- 2.39.5