]> git.lyx.org Git - features.git/commitdiff
* BufferView::updateMetrics(): allows the SinglePar optimization to proceed if the...
authorAbdelrazak Younes <younes@lyx.org>
Fri, 28 Sep 2007 08:19:03 +0000 (08:19 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 28 Sep 2007 08:19:03 +0000 (08:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20562 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp

index 21a3c9f67afb1cbdc4d03afe82919c1fd8656977..142faf5d71c5b2a9d88a1b296d8009dde9be7f6c 100644 (file)
@@ -1440,28 +1440,31 @@ void BufferView::updateMetrics(bool singlepar)
        pit_type const bottom_pit = cursor_.bottom().pit();
        // If the paragraph metrics has changed, we can not
        // use the singlepar optimisation.
-       if (singlepar
+       if (singlepar) {
+               int old_height = tm.parMetrics(bottom_pit).height();
                // In Single Paragraph mode, rebreak only
                // the (main text, not inset!) paragraph containing the cursor.
                // (if this paragraph contains insets etc., rebreaking will
                // recursively descend)
-               && !tm.redoParagraph(bottom_pit)) {
-
-               updateOffsetRef();
-               // collect cursor paragraph iter bounds
-               ParagraphMetrics const & pm = tm.parMetrics(bottom_pit);
-               int y1 = pm.position() - pm.ascent();
-               int y2 = pm.position() + pm.descent();
-               metrics_info_ = ViewMetricsInfo(bottom_pit, bottom_pit, y1, y2,
-                       SingleParUpdate, npit);
-               LYXERR(Debug::PAINTING)
-                       << BOOST_CURRENT_FUNCTION
-                       << "\ny1: " << y1
-                       << " y2: " << y2
-                       << " pit: " << bottom_pit
-                       << " singlepar: " << singlepar
-                       << endl;
-               return;
+               tm.redoParagraph(bottom_pit);
+               ParagraphMetrics const & pm = tm.parMetrics(bottom_pit);                
+               if (pm.height() == old_height) {
+                       // Paragraph height has not changed so we can proceed to
+                       // the singlePar optimisation.
+                       updateOffsetRef();
+                       int y1 = pm.position() - pm.ascent();
+                       int y2 = pm.position() + pm.descent();
+                       metrics_info_ = ViewMetricsInfo(bottom_pit, bottom_pit, y1, y2,
+                               SingleParUpdate, npit);
+                       LYXERR(Debug::PAINTING)
+                               << BOOST_CURRENT_FUNCTION
+                               << "\ny1: " << y1
+                               << " y2: " << y2
+                               << " pit: " << bottom_pit
+                               << " singlepar: " << singlepar
+                               << endl;
+                       return;
+               }
        }
 
        pit_type const pit = anchor_ref_;