Fix some scrolling issues.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22211 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-19 07:47:03 +00:00
parent edfa8bd4e7
commit 65dc5e8337
2 changed files with 22 additions and 6 deletions

View File

@ -392,9 +392,16 @@ void BufferView::processUpdateFlags(Update::flags flags)
bool const full_metrics = flags & Update::Force;
if (full_metrics || !singleParUpdate())
if (full_metrics || !singleParUpdate()) {
if (flags & Update::FitCursor) {
CursorSlice const & bot = d->cursor_.bottom();
TextMetrics const & tm = d->text_metrics_[bot.text()];
if (!tm.has(bot.pit()))
center();
}
// We have to update the full screen metrics.
updateMetrics();
}
if (!(flags & Update::FitCursor)) {
buffer_.changed();
@ -403,6 +410,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
//FIXME: updateMetrics() does not update paragraph position
// This is done at draw() time. So we need a redraw!
buffer_.changed();
if (!fitCursor())
// The screen has already been updated thanks to the
@ -672,13 +680,20 @@ void BufferView::updateOffsetRef()
if (height_ == 0)
return;
d->need_centering_ = false;
CursorSlice & bot = d->cursor_.bottom();
TextMetrics & tm = d->text_metrics_[bot.text()];
ParagraphMetrics const & pm = tm.parMetrics(bot.pit());
int y = coordOffset(d->cursor_, d->cursor_.boundary()).y_;
d->offset_ref_ = y + pm.ascent() - height_ / 2;
d->need_centering_ = false;
if (d->anchor_ref_ == 0)
d->offset_ref_ = 0;
else if (d->anchor_ref_ >= pos_type(bot.text()->paragraphs().size() - 1)) {
d->anchor_ref_ = bot.text()->paragraphs().size() - 1;
d->offset_ref_ = pm.height() - height_;
} else {
int y = coordOffset(d->cursor_, d->cursor_.boundary()).y_;
d->offset_ref_ = y + pm.ascent() - height_ / 2;
}
}
@ -1694,6 +1709,8 @@ void BufferView::updateMetrics()
d->update_strategy_ = FullScreenUpdate;
updateScrollbar();
if (lyxerr.debugging(Debug::WORKAREA)) {
LYXERR(Debug::WORKAREA, "BufferView::updateMetrics");
d->coord_cache_.dump();

View File

@ -460,7 +460,6 @@ void GuiWorkArea::updateScrollbar()
{
verticalScrollBar()->setTracking(false);
buffer_view_->updateScrollbar();
ScrollbarParameters const & scroll_ = buffer_view_->scrollbarParameters();
// do what cursor movement does (some grey)