|| flags == (Update::Decoration | Update::FitCursor)) {
// tell the frontend to update the screen if needed.
if (fitCursor()) {
- center();
+ showCursor();
return;
}
if (flags & Update::Decoration) {
if (full_metrics || !singleParUpdate()) {
if (flags & Update::FitCursor && fitCursor()) {
- center();
+ showCursor();
return;
}
// We have to update the full screen metrics.
// The screen needs to be recentered around the cursor position so
// refresh it:
- center();
+ showCursor();
}
// So we need a redraw!
buffer_.changed();
if (fitCursor())
- center();
+ showCursor();
}
return success;
}
-void BufferView::center()
+void BufferView::showCursor()
{
// We are not properly started yet, delay until resizing is
// done.
break;
case LFUN_SCREEN_RECENTER:
- center();
+ showCursor();
break;
case LFUN_BIBTEX_DATABASE_ADD: {
Point p = getPos(cur, cur.boundary());
if (p.y_ < 0 || p.y_ > height_) {
// The cursor is off-screen so recenter before proceeding.
- center();
+ showCursor();
p = getPos(cur, cur.boundary());
}
scroll(cmd.action == LFUN_SCREEN_UP? - height_ : height_);
/// set the cursor based on the given TeX source row.
void setCursorFromRow(int row);
- /// center the document view around the cursor.
- void center();
+ /// Ensure the cursor is visible.
+ /// This method will automatically scroll and update the BufferView and updated
+ /// if needed.
+ void showCursor();
/// scroll down document by the given number of pixels.
void scrollDown(int pixels);
/// scroll up document by the given number of pixels.
///
Buffer & buffer_;
- ///
- void updateOffsetRef();
-
struct Private;
Private * const d;
};