From 24cd681863d42a2696848728c7b5e3cf6a106823 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 8 Feb 2009 12:35:14 +0000 Subject: [PATCH] Fix bug 5573. http://bugzilla.lyx.org/show_bug.cgi?id=5573. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28397 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 42ad596320..4982e2dc20 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -819,7 +819,8 @@ void BufferView::showCursor(DocIterator const & dit) if (ypos - row_dim.ascent() < 0) scrolled = scrollUp(- ypos + row_dim.ascent()); else if (ypos + row_dim.descent() > height_) - scrolled = scrollDown(ypos - height_ + row_dim.descent()); + scrolled = scrollDown(ypos - defaultRowHeight()); + // else, nothing to do, the cursor is already visible so we just return. if (scrolled != 0) { updateMetrics(); @@ -845,8 +846,10 @@ void BufferView::showCursor(DocIterator const & dit) d->anchor_ypos_ = offset + pm.ascent(); else if (d->anchor_pit_ == max_pit) d->anchor_ypos_ = height_ - offset - row_dim.descent(); + else if (offset > height_) + d->anchor_ypos_ = height_ - offset - defaultRowHeight(); else - d->anchor_ypos_ = defaultRowHeight() * 2 - offset - row_dim.descent(); + d->anchor_ypos_ = defaultRowHeight() * 2; updateMetrics(); buffer_.changed(); -- 2.39.5