Temporarily fix jumpy cursor.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20526 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-26 21:27:17 +00:00
parent c1540f8d92
commit 5e8d4df0a5
2 changed files with 10 additions and 7 deletions

View File

@ -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;

View File

@ -172,11 +172,9 @@ ParagraphMetrics & TextMetrics::parMetrics(pit_type pit,
int TextMetrics::parPosition(pit_type pit) const
{
pair<pit_type, ParagraphMetrics> first = *par_metrics_.begin();
pair<pit_type, ParagraphMetrics> 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();