]> git.lyx.org Git - lyx.git/blobdiff - src/Undo.cpp
Now we can restore the old (and better) behavior of descriptions.
[lyx.git] / src / Undo.cpp
index 3b4bdf2f8872f076ae0f54d9cc6f69df6dfc2be9..a24bdead03e3861df2d6d18ab52e0b738be626ed 100644 (file)
@@ -4,10 +4,10 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Asger Alstrup
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author John Levon
- * \author André Pönitz
- * \author Jürgen Vigna
+ * \author André Pönitz
+ * \author Jürgen Vigna
  * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
@@ -285,7 +285,10 @@ void Undo::Private::doRecordUndo(UndoKind kind,
            && stack.top().end == end)
                return;
 
-       LYXERR(Debug::UNDO, "Create undo element of group " << group_id);
+       if (isFullBuffer)
+               LYXERR(Debug::UNDO, "Create full buffer undo element of group " << group_id);
+       else
+               LYXERR(Debug::UNDO, "Create undo element of group " << group_id);
        // create the position information of the Undo entry
        UndoElement undo(kind, cur, cell, from, end, 0, 0, 
                         buffer_.params(), isFullBuffer, group_id);
@@ -343,7 +346,7 @@ void Undo::Private::doTextUndoOrRedo(DocIterator & cur, UndoElementStack & stack
        // try to return early.
 
        // We will store in otherstack the part of the document under 'undo'
-       DocIterator cell_dit = undo.cell.asDocIterator(&buffer_.inset());
+       DocIterator cell_dit = undo.cell.asDocIterator(&buffer_);
 
        doRecordUndo(ATOMIC_UNDO, cell_dit,
                undo.from, cell_dit.lastpit() - undo.end, cur,
@@ -351,7 +354,7 @@ void Undo::Private::doTextUndoOrRedo(DocIterator & cur, UndoElementStack & stack
 
        // This does the actual undo/redo.
        //LYXERR0("undo, performing: " << undo);
-       DocIterator dit = undo.cell.asDocIterator(&buffer_.inset());
+       DocIterator dit = undo.cell.asDocIterator(&buffer_);
        if (undo.isFullBuffer) {
                LASSERT(undo.pars, /**/);
                // This is a full document
@@ -401,7 +404,7 @@ void Undo::Private::doTextUndoOrRedo(DocIterator & cur, UndoElementStack & stack
        LASSERT(undo.pars == 0, /**/);
        LASSERT(undo.array == 0, /**/);
 
-       cur = undo.cursor.asDocIterator(&buffer_.inset());
+       cur = undo.cursor.asDocIterator(&buffer_);
        // Now that we're done with undo, we pop it off the stack.
        stack.pop();
 }
@@ -423,8 +426,9 @@ bool Undo::Private::textUndoOrRedo(DocIterator & cur, bool isUndoOperation)
        while (!stack.empty() && stack.top().group_id == gid)
                doTextUndoOrRedo(cur, stack, otherstack);
 
-       // Addapt the new material to current buffer.
-       updateLabels(buffer_);
+       // Adapt the new material to current buffer.
+       buffer_.setBuffersForInsets(); // FIXME This shouldn't be here.
+       buffer_.updateLabels();
        return true;
 }
 
@@ -506,7 +510,7 @@ void Undo::recordUndoFullDocument(DocIterator const & cur)
        beginUndoGroup();
        d->doRecordUndo(
                ATOMIC_UNDO,
-               doc_iterator_begin(d->buffer_.inset()),
+               doc_iterator_begin(&d->buffer_),
                0, d->buffer_.paragraphs().size() - 1,
                cur,
                true,