mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Fix undo bugs.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5395 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fcb830103b
commit
f7d3fe8836
@ -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-09 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Bufferview_pimpl.C (dispatch): call InsetCitation::setLoadingBuffer
|
||||
|
@ -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
|
||||
|
@ -1266,9 +1266,11 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
* 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()) {
|
||||
@ -1359,8 +1361,6 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
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
|
||||
@ -1371,8 +1371,6 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
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 {
|
||||
@ -1384,8 +1382,6 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
break;
|
||||
|
||||
case LFUN_CUT: {
|
||||
setUndo(bv, Undo::DELETE,
|
||||
lt->cursor.par(), lt->cursor.par()->next());
|
||||
lt->cutSelection(bv);
|
||||
updwhat = CURSOR_PAR;
|
||||
updflag = true;
|
||||
@ -1425,8 +1421,11 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
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();
|
||||
@ -1459,8 +1458,11 @@ Inset::RESULT InsetText::localDispatch(FuncRequest const & ev)
|
||||
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;
|
||||
|
@ -154,15 +154,26 @@ 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 (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
|
||||
@ -174,21 +185,20 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user