mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
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:
parent
edfa8bd4e7
commit
65dc5e8337
@ -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();
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user