- Undo undo = stack.top();
- stack.pop();
- finishUndo();
-
- // this implements redo
- otherstack.push(undo);
- DocIterator dit =
- undo.cursor.asDocIterator(&bv.buffer()->inset());
- if (dit.inMathed()) {
- // Easy way out: store a full cell.
- otherstack.top().array = asString(dit.cell());
- } else {
- // As cells might be too large in texted, store just a part
- // of the paragraph list.
- otherstack.top().pars.clear();
- LyXText * text = dit.text();
- BOOST_ASSERT(text);
- ParagraphList & plist = text->paragraphs();
- if (undo.from + undo.end <= int(plist.size())) {
- ParagraphList::iterator first = plist.begin();
- advance(first, undo.from);
- ParagraphList::iterator last = plist.begin();
- advance(last, plist.size() - undo.end);
- otherstack.top().pars.insert(otherstack.top().pars.begin(), first, last);
- }
- }
- otherstack.top().cursor = bv.cursor();
- //lyxerr << " undo other: " << otherstack.top() << std::endl;
-
- performUndoOrRedo(bv, undo);