]> git.lyx.org Git - lyx.git/blobdiff - src/Undo.cpp
Fixed some lines that were too long. It compiled afterwards.
[lyx.git] / src / Undo.cpp
index 241e368e9b5d13a4b8ba3f718691a2801486a1c9..20c76462e3b3324b5ab5e914df53e09ff1c89fcf 100644 (file)
@@ -21,7 +21,7 @@
 #include "Cursor.h"
 #include "debug.h"
 #include "BufferView.h"
-#include "LyXText.h"
+#include "Text.h"
 #include "Paragraph.h"
 #include "ParagraphList.h"
 
@@ -104,9 +104,9 @@ void doRecordUndo(Undo::undo_kind kind,
                undo.array = new MathData(cell.cell());
        } else {
                // some more effort needed here as 'the whole cell' of the
-               // main LyXText _is_ the whole document.
+               // main Text _is_ the whole document.
                // record the relevant paragraphs
-               LyXText const * text = cell.text();
+               Text const * text = cell.text();
                BOOST_ASSERT(text);
                ParagraphList const & plist = text->paragraphs();
                ParagraphList::const_iterator first = plist.begin();
@@ -164,6 +164,7 @@ bool textUndoOrRedo(BufferView & bv,
 
        // This does the actual undo/redo.
        //lyxerr << "undo, performing: " << undo << std::endl;
+       bool labelsUpdateNeeded = false;
        DocIterator dit = undo.cell.asDocIterator(&buf->inset());
        if (undo.isFullBuffer) {
                BOOST_ASSERT(undo.pars);
@@ -184,7 +185,7 @@ bool textUndoOrRedo(BufferView & bv,
                undo.array = 0;
        } else {
                // Some finer machinery is needed here.
-               LyXText * text = dit.text();
+               Text * text = dit.text();
                BOOST_ASSERT(text);
                BOOST_ASSERT(undo.pars);
                ParagraphList & plist = text->paragraphs();
@@ -209,7 +210,7 @@ bool textUndoOrRedo(BufferView & bv,
                plist.insert(first, undo.pars->begin(), undo.pars->end());
                delete undo.pars;
                undo.pars = 0;
-               updateLabels(*buf);
+               labelsUpdateNeeded = true;
        }
        BOOST_ASSERT(undo.pars == 0);
        BOOST_ASSERT(undo.array == 0);
@@ -220,8 +221,10 @@ bool textUndoOrRedo(BufferView & bv,
        cur.selection() = false;
        cur.resetAnchor();
        cur.fixIfBroken();
+       
+       if (labelsUpdateNeeded)
+               updateLabels(*buf);
        finishUndo();
-
        return true;
 }