-
-// Returns false if no undo possible.
-bool textUndoOrRedo(BufferView & bv,
- limited_stack<Undo> & stack, limited_stack<Undo> & otherstack)
-{
- finishUndo();
-
- if (stack.empty()) {
- // Nothing to do.
- return false;
- }
-
- // Adjust undo stack and get hold of current undo data.
- Undo undo = stack.top();
- stack.pop();
-
- // We will store in otherstack the part of the document under 'undo'
- DocIterator cell_dit = undo.cell.asDocIterator(&bv.buffer()->inset());
-
- recordUndo(Undo::ATOMIC, cell_dit,
- undo.from, cell_dit.lastpit() - undo.end,
- bv.cursor(), otherstack);
-
- // This does the actual undo/redo.
- performUndoOrRedo(bv, undo);