From f403a65ad6120e05ae4da25fa8d28dcb097703f6 Mon Sep 17 00:00:00 2001 From: John Levon Date: Fri, 18 Apr 2003 18:32:07 +0000 Subject: [PATCH] alfredo's FIXME patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6831 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/text2.C | 43 +++++++++++++------------------------------ 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 90f769d600..aa80c60ec2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-04-16 Alfredo Braunstein + + * text2.C (redoParagraphs): eliminate good_prevrit, rewrite a loop + 2003-04-16 Alfredo Braunstein * bufferlist.C (quitWriteBuffer): WriteAs and MenuWrite return true diff --git a/src/text2.C b/src/text2.C index 2cbbe8077c..488ea9605a 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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(this)->postPaint(y - prevrit->height()); } else { -- 2.39.2