+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-09 Angus Leeming <leeming@lyx.org>
* Bufferview_pimpl.C (dispatch): call InsetCitation::setLoadingBuffer
+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
* 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->switchKeyMap();
if (lyxrc.auto_region_delete) {
if (lt->selection.set()) {
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
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 {
break;
case LFUN_CUT: {
- setUndo(bv, Undo::DELETE,
- lt->cursor.par(), lt->cursor.par()->next());
lt->cutSelection(bv);
updwhat = CURSOR_PAR;
updflag = true;
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();
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;
}
}
+ // 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 (lastundopar) {
+ lastundopar->next(behind);
+ if (behind)
+ behind->previous(lastundopar);
+ }
+
// put the new stuff in the list if there is one
if (undopar) {
+ undopar->previous(before);
if (before)
before->next(undopar);
else
bv->text->ownerParagraph(firstUndoParagraph(bv, undo.number_of_inset_id)->id(),
undopar);
- undopar->previous(before);
} else {
// We enter here on DELETE undo operations where we have to
// substitue the second paragraph with the first if the removed
}
}
- // thread the end of the undo onto the par in front if any
- if (lastundopar) {
- lastundopar->next(behind);
- if (behind)
- behind->previous(lastundopar);
- }
-
// 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 = undopar->inInset();
+ if (it)
+ it->getLyXText(bv)->setCursorIntern(bv, undopar, 0);
+ else
+ bv->text->setCursorIntern(bv, undopar, 0);
}
Paragraph * endpar = 0;