From 94c454c6ac6bc04c03744d23492a4f189d216cc3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 2 May 2003 15:21:45 +0000 Subject: [PATCH] undo-6.diff: another next() removed git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6928 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/text2.C | 2 +- src/undo_funcs.C | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/text2.C b/src/text2.C index c7babeb609..8ae8109bbd 100644 --- a/src/text2.C +++ b/src/text2.C @@ -963,7 +963,7 @@ void LyXText::setParagraph(bool line_top, bool line_bottom, ++endpit; undoendpit = endpit; } - } else if (endpit!= pars_end) { + } else if (endpit != pars_end) { // because of parindents etc. ++endpit; } diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 41fcd80cf1..24d4571d6c 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -118,10 +118,10 @@ bool textHandleUndo(BufferView * bv, Undo & undo) deletepar = before->next(); else deletepar = firstUndoParagraph(bv, undo.number_of_inset_id); - Paragraph * tmppar2 = undo.pars.front(); + // this surprisingly fills the undo! (Andre') + size_t par = 0; while (deletepar && deletepar != behind) { deletelist.push_back(deletepar); - Paragraph * tmppar = deletepar; deletepar = deletepar->next(); // A memory optimization for edit: @@ -129,8 +129,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo) // is stored in the undo. So restore // the text informations. if (undo.kind == Undo::EDIT) { - tmppar2->setContentsFromPar(*tmppar); - tmppar2 = tmppar2->next(); + undo.pars[par]->setContentsFromPar(*deletelist.back()); + ++par; } } } @@ -147,9 +147,9 @@ bool textHandleUndo(BufferView * bv, Undo & undo) } // Put the new stuff in the list if there is one. - Paragraph * undopar = undo.pars.empty() ? 0 : undo.pars.front(); - if (undopar) { - undopar->previous(before); + Paragraph * undopar = undo.pars.empty() ? 0 : undo.pars.front(); + if (!undo.pars.empty()) { + undo.pars.front()->previous(before); if (before) before->next(undopar); else { @@ -173,7 +173,6 @@ bool textHandleUndo(BufferView * bv, Undo & undo) } else { bv->buffer()->paragraphs.set(behind); } - undopar = behind; } } -- 2.39.2