summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a911b1c)
The cleanup in
11ca1406 was not correct. It is actually not possible to implement recordUndoInset from the undo API, since the cursor may not be at a different level than the text to be saved.
Fixes ticket #9553
void Cursor::recordUndoInset(Inset const * in) const
{
void Cursor::recordUndoInset(Inset const * in) const
{
- if (!in || in == &inset()) {
- CursorData c = *this;
- c.pop_back();
- buffer()->undo().recordUndo(c, c.pit(), c.pit());
- } else if (in == nextInset())
- recordUndo();
- else
- LYXERR0("Inset not found, no undo element added.");
+ buffer()->undo().recordUndoInset(*this, in);
+void Undo::recordUndoInset(CursorData const & cur, Inset const * inset)
+{
+ if (!inset || inset == &cur.inset()) {
+ DocIterator c = cur;
+ c.pop_back();
+ d->recordUndo(ATOMIC_UNDO, c, c.pit(), c.pit(), cur);
+ } else if (inset == cur.nextInset())
+ recordUndo(cur);
+ else
+ LYXERR0("Inset not found, no undo stack added.");
+}
+
+
void Undo::recordUndoBufferParams(CursorData const & cur)
{
d->recordUndoBufferParams(cur);
void Undo::recordUndoBufferParams(CursorData const & cur)
{
d->recordUndoBufferParams(cur);
/// paragraph or cell containing the cursor.
void recordUndo(CursorData const & cur, UndoKind kind = ATOMIC_UNDO);
/// paragraph or cell containing the cursor.
void recordUndo(CursorData const & cur, UndoKind kind = ATOMIC_UNDO);
+ /// prepare undo for the inset containing the cursor
+ void recordUndoInset(CursorData const & cur, Inset const * inset);
+
/// Convenience: record undo for buffer parameters
void recordUndoBufferParams(CursorData const & cur);
/// Convenience: record undo for buffer parameters
void recordUndoBufferParams(CursorData const & cur);