diff --git a/src/ChangeLog b/src/ChangeLog index ea694eff78..474449bb92 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2003-10-27 Alfredo Braunstein + + * 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 * MenuBackend.C: diff --git a/src/undo.C b/src/undo.C index bd2d6d0181..7f38077479 100644 --- a/src/undo.C +++ b/src/undo.C @@ -23,6 +23,8 @@ #include "lyxtext.h" #include "paragraph.h" +#include "insets/updatableinset.h" // for dynamic_cast + 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(inset)); + } + finishUndo(); return true; }