Small bugfix for undo.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3259 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2001-12-21 09:39:06 +00:00
parent cc0959da55
commit 5144bfbad9
2 changed files with 39 additions and 27 deletions

View File

@ -1,3 +1,9 @@
2001-12-21 Juergen Vigna <jug@sad.it>
* undo_funcs.C (textHandleUndo): fixed a case where tmppar3 is
accessed and could be 0 (I couldn't generate this but it seems
Michael could!).
2001-12-20 Lars Gullik Bjønnes <larsbj@birdstep.com> 2001-12-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
* tabular_funcs.C: add LIstream.h, move write_attribute to.. * tabular_funcs.C: add LIstream.h, move write_attribute to..

View File

@ -188,8 +188,10 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
tmppar3->previous(before); tmppar3->previous(before);
} else { } else {
// Do we really enter here ??? (Jug) // Do we really enter here ??? (Jug)
if (!before) if (!before && behind) {
bv->text->ownerParagraph(behind); bv->text->ownerParagraph(behind);
tmppar3 = behind;
}
} }
if (tmppar4) { if (tmppar4) {
tmppar4->next(behind); tmppar4->next(behind);
@ -213,17 +215,20 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
endpar = behind->next(); endpar = behind->next();
tmppar = bv->buffer()->getParFromID(undo->number_of_cursor_par); tmppar = bv->buffer()->getParFromID(undo->number_of_cursor_par);
if (tmppar3) {
UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->inInset()); UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->inInset());
if (it) { if (it) {
it->getLyXText(bv)->redoParagraphs(bv, it->getLyXText(bv)->cursor, it->getLyXText(bv)->redoParagraphs(bv,
it->getLyXText(bv)->cursor,
endpar); endpar);
LyXFont font; LyXFont font;
it->update(bv, font, false); it->update(bv, font, false);
// we now would have to rebreak the whole paragraph the undo-par // we now would have to rebreak the whole paragraph the
// was in. How we do it here is not really true. We would have to // undo-par was in. How we do it here is not really true.
// save this information in the undo-struct and then we could do // We would have to save this information in the undo-struct
// the right rebreak. Here we only handle the case where this // and then we could do the right rebreak. Here we only
// was in the actual paragraph, which not always is true. // handle the case where this was in the actual paragraph,
// which not always is true.
bv->text->redoParagraphs(bv, bv->text->cursor, bv->text->redoParagraphs(bv, bv->text->cursor,
bv->text->cursor.par()); bv->text->cursor.par());
if (tmppar){ if (tmppar){
@ -240,6 +245,7 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
} }
bv->text->setCursorIntern(bv, bv->text->cursor.par(), bv->text->setCursorIntern(bv, bv->text->cursor.par(),
bv->text->cursor.pos()); bv->text->cursor.pos());
}
} else { } else {
bv->text->redoParagraphs(bv, bv->text->cursor, endpar); bv->text->redoParagraphs(bv, bv->text->cursor, endpar);
if (tmppar) { if (tmppar) {