undo fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7982 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2003-10-27 10:03:04 +00:00
parent 4c3beeee65
commit 875cec0af0
2 changed files with 17 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2003-10-27 Alfredo Braunstein <abraunst@libero.it>
* undo.C (performUndoOrRedo): fix two crashes by setting a
cursor by hand and reordering some calls. Use bv->lockInset instead
of inset->edit because the latter loses cursor information
2003-10-25 Martin Vermeer <martin.vermeer@hut.fi>
* MenuBackend.C:

View File

@ -23,6 +23,8 @@
#include "lyxtext.h"
#include "paragraph.h"
#include "insets/updatableinset.h" // for dynamic_cast<UpdatableInset *>
using lyx::paroffset_type;
@ -188,23 +190,25 @@ bool performUndoOrRedo(BufferView * bv, Undo const & undo)
<< " inset: " << pit.inset()
<< " index: " << undo.index
<< std::endl;
InsetOld * inset = pit.inset();
if (inset) {
// magic needed to cope with inset locking
inset->edit(bv, undo.index);
}
// set cursor again to force the position to be the right one
text->setCursorIntern(undo.cursor_par, undo.cursor_pos);
text->cursor.par(undo.cursor_par);
text->cursor.pos(undo.cursor_pos);
// clear any selection
text->clearSelection();
text->selection.cursor = text->cursor;
text->updateCounters();
// rebreak the entire document
// rebreak the entire lyxtext
bv->text->fullRebreak();
InsetOld * inset = pit.inset();
if (inset) {
// magic needed to cope with inset locking
bv->lockInset(dynamic_cast<UpdatableInset *>(inset));
}
finishUndo();
return true;
}