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>
* 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);
} else {
// Do we really enter here ??? (Jug)
if (!before)
if (!before && behind) {
bv->text->ownerParagraph(behind);
tmppar3 = behind;
}
}
if (tmppar4) {
tmppar4->next(behind);
@ -211,35 +213,39 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
// calculate the endpar for redoing the paragraphs.
if (behind)
endpar = behind->next();
tmppar = bv->buffer()->getParFromID(undo->number_of_cursor_par);
UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->inInset());
if (it) {
it->getLyXText(bv)->redoParagraphs(bv, it->getLyXText(bv)->cursor,
endpar);
LyXFont font;
it->update(bv, font, false);
// we now would have to rebreak the whole paragraph the undo-par
// was in. How we do it here is not really true. We would have to
// save this information in the undo-struct and then we could do
// the right rebreak. Here we only handle the case where this
// was in the actual paragraph, which not always is true.
bv->text->redoParagraphs(bv, bv->text->cursor,
bv->text->cursor.par());
if (tmppar){
it = static_cast<UpdatableInset*>(tmppar->inInset());
LyXText * t;
if (it) {
it->edit(bv);
t = it->getLyXText(bv);
} else {
t = bv->text;
if (tmppar3) {
UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->inInset());
if (it) {
it->getLyXText(bv)->redoParagraphs(bv,
it->getLyXText(bv)->cursor,
endpar);
LyXFont font;
it->update(bv, font, false);
// we now would have to rebreak the whole paragraph the
// undo-par was in. How we do it here is not really true.
// We would have to save this information in the undo-struct
// and then we could do the right rebreak. Here we only
// handle the case where this was in the actual paragraph,
// which not always is true.
bv->text->redoParagraphs(bv, bv->text->cursor,
bv->text->cursor.par());
if (tmppar){
it = static_cast<UpdatableInset*>(tmppar->inInset());
LyXText * t;
if (it) {
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);
t->updateCounters(bv, t->cursor.row());
bv->text->setCursorIntern(bv, bv->text->cursor.par(),
bv->text->cursor.pos());
}
bv->text->setCursorIntern(bv, bv->text->cursor.par(),
bv->text->cursor.pos());
} else {
bv->text->redoParagraphs(bv, bv->text->cursor, endpar);
if (tmppar) {