[LyX/master] Honor scroll_below_document when jumping to end of document
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Tue Jul 18 17:57:12 UTC 2023
commit 008cec3eec348b43c106f939c6c60e325c4b5e78
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Tue Jul 11 22:26:00 2023 +0200
Honor scroll_below_document when jumping to end of document
While fixing #12491 at 0fed10e4, some band-aids were removed at the
end of `BufferView::scrollToBuffer`. One of them ensured that
scrolling to last paragraph would not leave the last row alone on
screen.
This behavior is actually correct when the scroll_below_document pref is true.
This commit restores the test that avoids the issue.
Of course, this does not fix the real issue, since for example opening
Tutorial.lyx and jumping to "5.3 Errors!" produces the same unwanted
effect.
---
src/BufferView.cpp | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 15911e8..85f1e61 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -1077,6 +1077,8 @@ 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;
+ else if (!lyxrc.scroll_below_document && d->anchor_pit_ == max_pit)
+ d->anchor_ypos_ = height_ - offset - row_dim.descent();
return d->anchor_ypos_ != old_ypos || d->anchor_pit_ != old_pit;
}
More information about the lyx-cvs
mailing list