}
if (lyx_view_ && view()->buffer()) {
+ // BufferView::update() updates the ViewMetricsInfo and
+ // also initializes the position cache for all insets in
+ // (at least partially) visible top-level paragraphs.
+ std::pair<bool, bool> needSecondUpdate
+ = view()->update(updateFlags);
+
// Redraw screen unless explicitly told otherwise.
- // This also initializes the position cache for all insets
- // in (at least partially) visible top-level paragraphs.
- bool needSecondUpdate = false;
- if (updateFlags != Update::None)
- needSecondUpdate = view()->update(updateFlags);
- else
- needSecondUpdate = view()->fitCursor();
+ if (needSecondUpdate.first)
+ // Buffer::changed() signals that a repaint is needed.
+ // The frontend (WorkArea) knows which area to repaint
+ // thanks to the ViewMetricsInfo updated above.
+ view()->buffer()->changed();
- if (needSecondUpdate || updateFlags != Update::None) {
- view()->buffer()->changed(updateFlags & Update::SinglePar);
- }
lyx_view_->updateStatusBar();
// if we executed a mutating lfun, mark the buffer as dirty