}
-void BufferView::scrollDocView(int value)
+void BufferView::scrollDocView(int value, bool update)
{
int const offset = value - d->scrollbarParameters_.position;
// cut off at the top
if (value <= d->scrollbarParameters_.min) {
DocIterator dit = doc_iterator_begin(&buffer_);
- showCursor(dit, false);
+ showCursor(dit, false, update);
LYXERR(Debug::SCROLLING, "scroll to top");
return;
}
if (value >= d->scrollbarParameters_.max) {
DocIterator dit = doc_iterator_end(&buffer_);
dit.backwardPos();
- showCursor(dit, false);
+ showCursor(dit, false, update);
LYXERR(Debug::SCROLLING, "scroll to bottom");
return;
}
// It seems we didn't find the correct pit so stay on the safe side and
// scroll to bottom.
LYXERR0("scrolling position not found!");
- scrollDocView(d->scrollbarParameters_.max);
+ scrollDocView(d->scrollbarParameters_.max, update);
return;
}
DocIterator dit = doc_iterator_begin(&buffer_);
dit.pit() = i;
LYXERR(Debug::SCROLLING, "value = " << value << " -> scroll to pit " << i);
- showCursor(dit, false);
+ showCursor(dit, false, update);
}
void BufferView::recenter()
{
- showCursor(d->cursor_, true);
+ showCursor(d->cursor_, true, true);
}
void BufferView::showCursor()
{
- showCursor(d->cursor_, false);
+ showCursor(d->cursor_, false, true);
}
-void BufferView::showCursor(DocIterator const & dit, bool recenter)
+void BufferView::showCursor(DocIterator const & dit,
+ bool recenter, bool update)
{
- if (scrollToCursor(dit, recenter)) {
+ if (scrollToCursor(dit, recenter) && update) {
buffer_.changed(true);
updateHoveredInset();
}
/// This method will automatically scroll and update the BufferView
/// if needed.
/// \param recenter Whether the cursor should be centered on screen
- void showCursor(DocIterator const & dit, bool recenter);
+ void showCursor(DocIterator const & dit, bool recenter,
+ bool update);
/// Scroll to the cursor.
void scrollToCursor();
/// Scroll to the cursor.
/// scroll document by the given number of pixels.
int scroll(int pixels);
/// Scroll the view by a number of pixels.
- void scrollDocView(int pixels);
+ void scrollDocView(int pixels, bool update);
/// Set the cursor position based on the scrollbar one.
void setCursorFromScrollbar();
// col_type const col = tabular.cellColumn(cur.idx());
// int const t = cur.bv().top_y() + cur.bv().height();
// if (t < yo() + tabular.getHeightOfTabular()) {
-// cur.bv().scrollDocView(t);
+// cur.bv().scrollDocView(t, true);
// cur.idx() = tabular.cellBelow(first_visible_cell) + col;
// } else {
// cur.idx() = tabular.getFirstCellInRow(tabular.rows() - 1) + col;
// col_type const col = tabular.cellColumn(cur.idx());
// int const t = cur.bv().top_y() + cur.bv().height();
// if (yo() < 0) {
-// cur.bv().scrollDocView(t);
+// cur.bv().scrollDocView(t, true);
// if (yo() > 0)
// cur.idx() = col;
// else