X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FUndo.cpp;h=a479728ebde2b280e519e3c09734f292f709386f;hb=4d845baf0867f15531f10d25b9611d39ac282428;hp=7b924c7b49a6e73b0bbca83287daa9f60a538860;hpb=b63421b7dc65e0c721f8928d1330b9bb2cff43d8;p=lyx.git diff --git a/src/Undo.cpp b/src/Undo.cpp index 7b924c7b49..a479728ebd 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -21,6 +21,8 @@ #include "BufferParams.h" #include "buffer_funcs.h" #include "Cursor.h" +#include "CutAndPaste.h" +#include "ErrorList.h" #include "Paragraph.h" #include "ParagraphList.h" #include "Text.h" @@ -29,6 +31,7 @@ #include "mathed/MathData.h" #include "insets/Inset.h" +#include "insets/InsetText.h" #include "support/debug.h" #include "support/gettext.h" @@ -453,7 +456,13 @@ void Undo::Private::doTextUndoOrRedo(CursorData & cur, UndoElementStack & stack, // This is a params undo element delete otherstack.top().bparams; otherstack.top().bparams = new BufferParams(buffer_.params()); + DocumentClassConstPtr olddc = buffer_.params().documentClassPtr(); buffer_.params() = *undo.bparams; + // The error list is not supposed to be helpful here. + ErrorList el; + cap::switchBetweenClasses(olddc, buffer_.params().documentClassPtr(), + static_cast(buffer_.inset()), el); + LATTEST(el.empty()); } else if (dit.inMathed()) { // We stored the full cell here as there is not much to be // gained by storing just 'a few' paragraphs (most if not @@ -634,6 +643,13 @@ void Undo::recordUndoFullBuffer(CursorData const & cur) /// UndoGroupHelper class stuff +/** FIXME: handle restarted groups + * It may happen that the buffers are visited in order buffer1, + * buffer2, buffer1. In this case, we want to have only one undo group + * in buffer1. One solution is to replace buffer_ with a set, + * but I am not sure yet how to do it. A use case is + * InsetLabel::updateReferences. + */ void UndoGroupHelper::resetBuffer(Buffer * buf) { if (buf == buffer_)