]> git.lyx.org Git - features.git/commitdiff
undo-6.diff: another next() removed
authorAndré Pönitz <poenitz@gmx.net>
Fri, 2 May 2003 15:21:45 +0000 (15:21 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 2 May 2003 15:21:45 +0000 (15:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6928 a592a061-630c-0410-9148-cb99ea01b6c8

src/text2.C
src/undo_funcs.C

index c7babeb609ecf9f262e0211f224fd09dc28293e4..8ae8109bbd4e8c73272312d9c406bc5be4c02c2f 100644 (file)
@@ -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;
        }
index 41fcd80cf10ac26e2a0e2a9536c26a0abd49bafb..24d4571d6c86bb05519f8aa999c4132eaf7790e4 100644 (file)
@@ -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;
                }
        }