#include "lyxtext.h"
#include "paragraph.h"
+#include "insets/updatableinset.h" // for dynamic_cast<UpdatableInset *>
+
using lyx::paroffset_type;
for ( ; num && pit != end; ++pit, --num)
;
-
+
if (pit != end)
return pit;
ParagraphList::iterator last = plist.begin();
advance(last, last_par);
- for (ParagraphList::iterator it = first; it != last; ++it) {
+ for (ParagraphList::iterator it = first; it != last; ++it)
undo_pars.push_back(*it);
- undo_pars.back().id(it->id());
- }
undo_pars.push_back(*last);
- undo_pars.back().id(last->id());
// and make sure that next time, we should be combining if possible
undo_finished = false;
// set cursor
lyxerr << "undo, text: " << undo.text
- << " inset: " << pit.inset()
- << " index: " << undo.index
- << std::endl;
- InsetOld * inset = pit.inset();
- if (inset) {
- // magic needed to cope with inset locking
- inset->edit(bv, undo.index);
- }
+ << " inset: " << pit.inset()
+ << " index: " << undo.index
+ << " par: " << undo.cursor_par
+ << " pos: " << undo.cursor_pos
+ << std::endl;
// set cursor again to force the position to be the right one
- text->setCursorIntern(undo.cursor_par, undo.cursor_pos);
+ text->cursor.par(undo.cursor_par);
+ text->cursor.pos(undo.cursor_pos);
// clear any selection
text->clearSelection();
text->selection.cursor = text->cursor;
text->updateCounters();
- // rebreak the entire document
+ // rebreak the entire lyxtext
bv->text->fullRebreak();
+ pit.lockPath(bv);
+
finishUndo();
return true;
}