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,33 +215,37 @@ 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);
UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->inInset()); if (tmppar3) {
if (it) { UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->inInset());
it->getLyXText(bv)->redoParagraphs(bv, it->getLyXText(bv)->cursor, if (it) {
endpar); it->getLyXText(bv)->redoParagraphs(bv,
LyXFont font; it->getLyXText(bv)->cursor,
it->update(bv, font, false); endpar);
// we now would have to rebreak the whole paragraph the undo-par LyXFont font;
// was in. How we do it here is not really true. We would have to it->update(bv, font, false);
// save this information in the undo-struct and then we could do // we now would have to rebreak the whole paragraph the
// the right rebreak. Here we only handle the case where this // undo-par was in. How we do it here is not really true.
// was in the actual paragraph, which not always is true. // We would have to save this information in the undo-struct
bv->text->redoParagraphs(bv, bv->text->cursor, // and then we could do the right rebreak. Here we only
bv->text->cursor.par()); // handle the case where this was in the actual paragraph,
if (tmppar){ // which not always is true.
it = static_cast<UpdatableInset*>(tmppar->inInset()); bv->text->redoParagraphs(bv, bv->text->cursor,
LyXText * t; bv->text->cursor.par());
if (it) { if (tmppar){
it->edit(bv); it = static_cast<UpdatableInset*>(tmppar->inInset());
t = it->getLyXText(bv); LyXText * t;
} else { if (it) {
t = bv->text; it->edit(bv);
t = it->getLyXText(bv);
} else {
t = bv->text;
}
t->setCursorIntern(bv, tmppar, undo->cursor_pos);
t->updateCounters(bv, t->cursor.row());
} }
t->setCursorIntern(bv, tmppar, undo->cursor_pos); bv->text->setCursorIntern(bv, bv->text->cursor.par(),
t->updateCounters(bv, t->cursor.row()); bv->text->cursor.pos());
} }
bv->text->setCursorIntern(bv, bv->text->cursor.par(),
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) {