+void Undo::beginUndoGroup()
+{
+ if (d->group_level == 0) {
+ // create a new group
+ ++d->group_id;
+ LYXERR(Debug::UNDO, "+++++++Creating new group " << d->group_id);
+ }
+ ++d->group_level;
+}
+
+
+void Undo::endUndoGroup()
+{
+ if (d->group_level == 0) {
+ LYXERR0("There is no undo group to end here");
+ return;
+ }
+ --d->group_level;
+ if (d->group_level == 0) {
+ // real end of the group
+ LYXERR(Debug::UNDO, "-------End of group " << d->group_id);
+ }
+}
+
+
+void Undo::endUndoGroup(CursorData const & cur)
+{
+ endUndoGroup();
+ if (!d->undostack_.empty() && d->undostack_.top().cur_after.empty())
+ d->undostack_.top().cur_after = cur;
+}
+
+
+// FIXME: remove these convenience functions and make
+// Private::recordUndo public as sole interface. The code in the
+// convenience functions can move to Cursor.cpp.
+
+void Undo::recordUndo(CursorData const & cur, UndoKind kind)