- // This implements redo
- otherstack.push(undo);
- // FIXME: This triggers the error in dociterator.C +454
- // could the reason be that we rebuild the dit _before_ the
- // contents is actually 'undone'?
- // I.e. state now is 'A', state on undo stack is 'B'.
- // dit is created according to positions from undo.cursor, i.e. B
- // but current buffer contents is more likely 'A'.
- 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);