]> git.lyx.org Git - features.git/commitdiff
alfredo's FIXME patch
authorJohn Levon <levon@movementarian.org>
Fri, 18 Apr 2003 18:32:07 +0000 (18:32 +0000)
committerJohn Levon <levon@movementarian.org>
Fri, 18 Apr 2003 18:32:07 +0000 (18:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6831 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text2.C

index 90f769d600fc7817d8f28f680676bbecaa9938fa..aa80c60ec2dcd483f97be658ecef48bcbc1187e5 100644 (file)
@@ -1,3 +1,7 @@
+2003-04-16  Alfredo Braunstein  <abraunst@libero.it>
+       * text2.C (redoParagraphs): eliminate good_prevrit, rewrite a loop
 2003-04-16  Alfredo Braunstein  <abraunst@libero.it>
 
        * bufferlist.C (quitWriteBuffer): WriteAs and MenuWrite return true
index 2cbbe8077cf8c2531f04a469ea1281d6a21906f0..488ea9605a58cd920ec8dcb3910ebd8b5c6d9a32 100644 (file)
@@ -646,6 +646,7 @@ void LyXText::redoParagraphs(LyXCursor const & cur,
        int y = cur.y() - tmprit->baseline();
 
        ParagraphList::iterator first_phys_pit;
+       RowList::iterator prevrit;
        if (tmprit == rows().begin()) {
                // A trick/hack for UNDO.
                // This is needed because in an UNDO/REDO we could have
@@ -653,8 +654,7 @@ void LyXText::redoParagraphs(LyXCursor const & cur,
                // the row is NOT my really first par anymore.
                // Got it Lars ;) (Jug 20011206)
                first_phys_pit = ownerParagraphs().begin();
-#warning FIXME
-               // In here prevrit could be set to rows().end(). (Lgb)
+               prevrit = rows().end();
        } else {
                first_phys_pit = tmprit->par();
                while (tmprit != rows().begin()
@@ -663,18 +663,7 @@ void LyXText::redoParagraphs(LyXCursor const & cur,
                        --tmprit;
                        y -= tmprit->height();
                }
-#warning FIXME
-               // Is it possible to put the prevrit setting in here? (Lgb)
-       }
-
-       RowList::iterator prevrit;
-       bool good_prevrit = false;
-#warning FIXME
-       // It seems to mee that good_prevrit is not needed if we let
-       // a bad prevrit have the value rows().end() (Lgb)
-       if (tmprit != rows().begin()) {
                prevrit = boost::prior(tmprit);
-               good_prevrit = true;
        }
 
        // remove it
@@ -685,24 +674,18 @@ void LyXText::redoParagraphs(LyXCursor const & cur,
 
        // Reinsert the paragraphs.
        ParagraphList::iterator tmppit = first_phys_pit;
-#warning FIXME
-       // See if this loop can be rewritten as a while loop instead.
-       // That should also make the code a bit easier to read. (Lgb)
-       do {
-               if (tmppit != ownerParagraphs().end()) {
-                       insertParagraph(tmppit, tmprit);
-                       while (tmprit != rows().end()
-                              && tmprit->par() == tmppit) {
-                               ++tmprit;
-                       }
-                       ++tmppit;
-               }
-       } while (tmppit != ownerParagraphs().end() && tmppit != endpit);
 
-#warning FIXME
-       // If the above changes are done, then we can compare prevrit
-       // with rows().end() here. (Lgb)
-       if (good_prevrit) {
+       while (tmppit != ownerParagraphs().end()) {
+               insertParagraph(tmppit, tmprit);
+               while (tmprit != rows().end()
+                      && tmprit->par() == tmppit) {
+                       ++tmprit;
+               }
+               ++tmppit;
+               if (tmppit == endpit)
+                       break;
+       }
+       if (prevrit != rows().end()) {
                setHeightOfRow(prevrit);
                const_cast<LyXText *>(this)->postPaint(y - prevrit->height());
        } else {