]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView_pimpl.C
* remove various xforms relicts, in particular:
[lyx.git] / src / BufferView_pimpl.C
index 43f384f6022cf2dfc2a628cd366f57ba633c02fb..2365d64f11a17e1f5110d7c4ef7332305fc41e8f 100644 (file)
@@ -689,45 +689,44 @@ ViewMetricsInfo const & BufferView::Pimpl::viewMetricsInfo()
 
 void BufferView::Pimpl::update(Update::flags flags)
 {
-       lyxerr[Debug::DEBUG]
-               << BOOST_CURRENT_FUNCTION
-               << "[fitcursor = " << (flags & Update::FitCursor)
-               << ", forceupdate = " << (flags & Update::Force)
-               << ", singlepar = " << (flags & Update::SinglePar)
-               << "]  buffer: " << buffer_ << endl;
+       // This is close to a hot-path.
+       if (lyxerr.debugging(Debug::DEBUG)) {
+               lyxerr[Debug::DEBUG]
+                       << BOOST_CURRENT_FUNCTION
+                       << "[fitcursor = " << (flags & Update::FitCursor)
+                       << ", forceupdate = " << (flags & Update::Force)
+                       << ", singlepar = " << (flags & Update::SinglePar)
+                       << "]  buffer: " << buffer_ << endl;
+       }
 
        // Check needed to survive LyX startup
        if (buffer_) {
                // Update macro store
                buffer_->buildMacros();
 
-               CoordCache backup;
-               std::swap(theCoords, backup);
-
                // This, together with doneUpdating(), verifies (using
                // asserts) that screen redraw is not called from
                // within itself.
                theCoords.startUpdating();
 
                // First drawing step
-               updateMetrics(flags & Update::SinglePar);
+               bool singlePar = flags & Update::SinglePar;
                bool forceupdate(flags & (Update::Force | Update::SinglePar));
 
-               if ((flags & Update::FitCursor) && fitCursor()) {
+               if ((flags & (Update::FitCursor | Update::MultiParSel))
+                   && (fitCursor() || multiParSel())) {
                        forceupdate = true;
-                       updateMetrics();
-               }
-               if ((flags & Update::MultiParSel) && multiParSel()) {
-                       forceupdate = true;
-                       updateMetrics();
+                       singlePar = false;
                }
+
                if (forceupdate) {
                        // Second drawing step
+                       updateMetrics(singlePar);
                        owner_->workArea()->redraw(*bv_);
                } else {
                        // Abort updating of the coord
                        // cache - just restore the old one
-                       std::swap(theCoords, backup);
+                       theCoords.doneUpdating();
                }
        } else
                owner_->workArea()->greyOut();