StableDocIterator const & cel,
pit_type fro, pit_type en, ParagraphList * pl,
MathData * ar, BufferParams const & bp,
- bool ifb, size_t gid) :
+ bool ifb, bool lc, size_t gid) :
kind(kin), cursor(cur), cell(cel), from(fro), end(en),
- pars(pl), array(ar), bparams(0), isFullBuffer(ifb), group_id(gid)
+ pars(pl), array(ar), bparams(0), isFullBuffer(ifb), lyx_clean(lc), group_id(gid)
{
if (isFullBuffer)
bparams = new BufferParams(bp);
bparams = ue.isFullBuffer
? new BufferParams(*ue.bparams) : ue.bparams;
isFullBuffer = ue.isFullBuffer;
+ lyx_clean = ue.lyx_clean;
group_id = ue.group_id;
}
///
BufferParams const * bparams;
/// Only used in case of full backups
bool isFullBuffer;
+ /// Was the buffer clean at this point?
+ bool lyx_clean;
/// the element's group id
size_t group_id;
private:
}
}
+ /// Mark all the elements of the stack as dirty
+ void markDirty() {
+ for (size_t i = 0; i != c_.size(); ++i)
+ c_[i].lyx_clean = false;
+ }
+
private:
/// Internal contents.
std::deque<UndoElement> c_;
}
-static bool samePar(StableDocIterator const & i1, StableDocIterator const & i2)
+void Undo::markDirty()
{
- StableDocIterator tmpi2 = i2;
- tmpi2.pos() = i1.pos();
- return i1 == tmpi2;
+ d->undo_finished_ = true;
+ d->undostack_.markDirty();
+ d->redostack_.markDirty();
}
//
///////////////////////////////////////////////////////////////////////
+static bool samePar(StableDocIterator const & i1, StableDocIterator const & i2)
+{
+ StableDocIterator tmpi2 = i2;
+ tmpi2.pos() = i1.pos();
+ return i1 == tmpi2;
+}
+
+
void Undo::Private::doRecordUndo(UndoKind kind,
DocIterator const & cell,
pit_type first_pit, pit_type last_pit,
LYXERR(Debug::UNDO, "Create undo element of group " << group_id);
// create the position information of the Undo entry
UndoElement undo(kind, cur, cell, from, end, 0, 0,
- buffer_.params(), isFullBuffer, group_id);
+ buffer_.params(), isFullBuffer, buffer_.isClean(), group_id);
// fill in the real data to be saved
if (cell.inMathed()) {
// simply use the whole cell
- undo.array = new MathData(cell.cell());
+ MathData & ar = cell.cell();
+ undo.array = new MathData(ar.buffer(), ar.begin(), ar.end());
} else {
// some more effort needed here as 'the whole cell' of the
// main Text _is_ the whole document.
LASSERT(undo.array == 0, /**/);
cur = undo.cursor.asDocIterator(&buffer_);
+ if (undo.lyx_clean)
+ buffer_.markClean();
+ else
+ buffer_.markDirty();
// Now that we're done with undo, we pop it off the stack.
stack.pop();
}
while (!stack.empty() && stack.top().group_id == gid)
doTextUndoOrRedo(cur, stack, otherstack);
- // Addapt the new material to current buffer.
- buffer_.updateLabels();
+ // Adapt the new material to current buffer.
+ buffer_.setBuffersForInsets(); // FIXME This shouldn't be here.
return true;
}