Clear undo/redo stack when reloading buffer. This fixes #7208.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37155 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2011-01-09 17:55:16 +00:00
parent 23609ed7fb
commit a07d9f2192
3 changed files with 14 additions and 0 deletions

View File

@ -4250,6 +4250,7 @@ Buffer::ReadStatus Buffer::reload()
updateTitles();
markClean();
message(bformat(_("Document %1$s reloaded."), disp_fn));
d->undo_.clear();
} else {
message(bformat(_("Could not reload document %1$s."), disp_fn));
}

View File

@ -241,6 +241,16 @@ Undo::~Undo()
}
void Undo::clear()
{
d->undostack_.clear();
d->redostack_.clear();
d->undo_finished_ = true;
d->group_id = 0;
d->group_level;
}
bool Undo::hasUndoStack() const
{
return !d->undostack_.empty();

View File

@ -53,6 +53,9 @@ public:
~Undo();
/// Clear out all undo/redo contents.
void clear();
/// this will undo the last action - returns false if no undo possible
bool textUndo(DocIterator &);