From 5e8d4df0a522d33c9b31f8e39602176cc62fc9b6 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 26 Sep 2007 21:27:17 +0000 Subject: [PATCH] Temporarily fix jumpy cursor. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20526 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 9 +++++++-- src/TextMetrics.cpp | 8 +++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index eed6d0403d..345f05740f 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -251,8 +251,13 @@ bool BufferView::update(Update::flags flags) bool const single_par = !full_metrics; updateMetrics(single_par); - if (flags & Update::FitCursor && fitCursor()) - updateMetrics(false); + if (flags & Update::FitCursor) { + //FIXME: updateMetrics() does not update paragraph position + // This is done at draw() time. So we need a redraw! + buffer_.changed(); + if (fitCursor()) + updateMetrics(false); + } // tell the frontend to update the screen. return true; diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index b17408cee7..f751720f98 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -172,11 +172,9 @@ ParagraphMetrics & TextMetrics::parMetrics(pit_type pit, int TextMetrics::parPosition(pit_type pit) const { - pair first = *par_metrics_.begin(); - pair last = *par_metrics_.rbegin(); - if (pit < first.first) - return -1000000; - else if (pit > last.first) + if (pit < par_metrics_.begin()->first) + return -1000000; + else if (pit > par_metrics_.rbegin()->first) return +1000000; return par_metrics_[pit].position(); -- 2.39.2