From e2f312f8f0495ed30ee64b6078f2749158c58325 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Sat, 15 Nov 2008 18:17:20 +0000 Subject: [PATCH] * save one redraw on each change of the scrollbar. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27471 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 0bb341ac30..8d8c7e6975 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -549,9 +549,14 @@ docstring BufferView::contextMenu(int x, int y) const void BufferView::scrollDocView(int value) { int const offset = value - d->scrollbarParameters_.position; + + // No scrolling at all? No need to redraw anything + if (offset == 0) + return; + // If the offset is less than 2 screen height, prefer to scroll instead. if (abs(offset) <= 2 * height_) { - scroll(offset); + d->anchor_ypos_ -= offset; updateMetrics(); buffer_.changed(); return; @@ -2192,6 +2197,7 @@ void BufferView::draw(frontend::Painter & pain) if (height_ == 0 || width_ == 0) return; LYXERR(Debug::PAINTING, "\t\t*** START DRAWING ***"); + Text & text = buffer_.text(); TextMetrics const & tm = d->text_metrics_[&text]; int const y = tm.first().second->position();