fix undo crash

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH-1_2_X@5443 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2002-10-18 14:21:06 +00:00
parent 99b0a3d98a
commit ecabb2266f
5 changed files with 52 additions and 16 deletions

View File

@ -1,3 +1,11 @@
2002-10-14 Juergen Vigna <jug@sad.it>
* undo_funcs.C (textHandleUndo): alter the order in which the
new undopar is added to the LyXText, as we have to set first
the right prev/next and then add it as otherwise the rebuild of
LyXText is not correct. Also reset the cursor to the right paragraph,
with this IMO we could remove the hack in "redoParagraphs()".
2002-10-14 Dekel Tsur <dekelts@tau.ac.il>
* FontInfo.C (query): Ignore bogus matches of scalable fonts.

View File

@ -1,3 +1,8 @@
2002-10-14 Juergen Vigna <jug@sad.it>
* insettext.C (localDispatch): remove double setUndo in Cut/Delete/
Backspace functions which confused the Undo handling.
2002-10-09 Angus Leeming <leeming@lyx.org>
* insetcite.[Ch] (setLoadingBuffer): new method, invoked by

View File

@ -1266,9 +1266,11 @@ InsetText::localDispatch(BufferView * bv,
* typed in now. Depends on lyxrc settings
* "auto_region_delete", which defaults to
* true (on). */
#if 0
// This should not be needed here and is also WRONG!
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
#endif
bv->setState();
if (lyxrc.auto_region_delete) {
if (lt->selection.set()) {
@ -1340,8 +1342,6 @@ InsetText::localDispatch(BufferView * bv,
updwhat = CURSOR;
break;
case LFUN_BACKSPACE: {
setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next());
if (lt->selection.set())
lt->cutSelection(bv, true, false);
else
@ -1352,8 +1352,6 @@ InsetText::localDispatch(BufferView * bv,
break;
case LFUN_DELETE: {
setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next());
if (lt->selection.set()) {
lt->cutSelection(bv, true, false);
} else {
@ -1365,8 +1363,6 @@ InsetText::localDispatch(BufferView * bv,
break;
case LFUN_CUT: {
setUndo(bv, Undo::DELETE,
lt->cursor.par(), lt->cursor.par()->next());
lt->cutSelection(bv);
updwhat = CURSOR_PAR;
updflag = true;
@ -1406,8 +1402,11 @@ InsetText::localDispatch(BufferView * bv,
break;
}
}
#if 0
// This should not be needed here and is also WRONG!
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
#endif
lt->pasteSelection(bv);
// bug 393
lt->clearSelection();
@ -1440,8 +1439,11 @@ InsetText::localDispatch(BufferView * bv,
result = DISPATCHED;
break;
}
#if 0
// This should not be needed here and is also WRONG!
setUndo(bv, Undo::INSERT,
lt->cursor.par(), lt->cursor.par()->next());
#endif
lt->insertChar(bv, Paragraph::META_NEWLINE);
updwhat = CURSOR | CURSOR_PAR;
updflag = true;

View File

@ -182,15 +182,25 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
}
}
// The order here is VERY IMPORTANT. We have to set the right
// next/prev pointer in the paragraphs so that a rebuild of
// the LyXText works!!!
// thread the end of the undo onto the par in front if any
if (tmppar4) {
tmppar4->next(behind);
if (behind)
behind->previous(tmppar4);
}
// put the new stuff in the list if there is one
if (tmppar3) {
tmppar3->previous(before);
if (before)
before->next(tmppar3);
else
bv->text->ownerParagraph(firstUndoParagraph(bv, undo->number_of_inset_id)->id(),
tmppar3);
tmppar3->previous(before);
} else {
// We enter here on DELETE undo operations where we have to
// substitue the second paragraph with the first if the removed
@ -201,20 +211,21 @@ bool textHandleUndo(BufferView * bv, Undo * undo)
tmppar3 = behind;
}
}
if (tmppar4) {
tmppar4->next(behind);
if (behind)
behind->previous(tmppar4);
}
// Set the cursor for redoing
if (before) {
if (before) { // if we have a par before the undopar
Inset * it = before->inInset();
if (it)
it->getLyXText(bv)->setCursorIntern(bv, before, 0);
else
bv->text->setCursorIntern(bv, before, 0);
} else { // otherwise this is the first one and we start here
Inset * it = tmppar3->inInset();
if (it)
it->getLyXText(bv)->setCursorIntern(bv, tmppar3, 0);
else
bv->text->setCursorIntern(bv, tmppar3, 0);
}
Paragraph * endpar = 0;

View File

@ -46,11 +46,16 @@ What's new
- fix bug with handling of EPSI files (this was a new bug in 1.2.1)
- fix crash with undo
- fix lockup when changing the layout of several paragraphs at the
same time (and the layout of the first paragraph is already correct)
- fix bug with graphics files which name contain a '.'
- fix bug in the xforms image loader, where images would be cropped by
a couple pixels
- when a viewer has not been found (set to "none"), remove the
corresponding View menu entry
@ -72,9 +77,14 @@ What's new
- fix drawing problem when a line of text contains both left-to-right
and right-to-left text
- ignore bugs matches of scalable fonts
- when loading a font fails, show the name of the said font
- harmonize the behavior of delete and backspace in main text,
insettext, and tabulars, i.e. don't put stuff into the clipboard
- add missing autoconf file xforms.m4
- fix compilation problem (missing <wchar.h>) on some BSD systems
(including Mac OS X)