]> git.lyx.org Git - lyx.git/commitdiff
simpler logic to create 'end' from 'behind'
authorAndré Pönitz <poenitz@gmx.net>
Tue, 29 Apr 2003 14:31:53 +0000 (14:31 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 29 Apr 2003 14:31:53 +0000 (14:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6883 a592a061-630c-0410-9148-cb99ea01b6c8

src/undo_funcs.C

index ddda43f5799f3dbc6734bd323f99a8f4fa1d1fa0..3c63678097bc8df029a14be91719615166b8abf4 100644 (file)
@@ -321,18 +321,11 @@ bool createUndo(BufferView * bv, Undo::undo_kind kind,
        }
 
        // create a new Undo
-       Paragraph * undopar;
+       Paragraph * undopar = 0; // nothing to replace yet (undo of delete maybe)
 
        Paragraph * start = first;
-       Paragraph * end = 0;
+       Paragraph * end = &*boost::prior(itbehind);
 
-       if (behind)
-               end = const_cast<Paragraph*>(behind->previous());
-       else {
-               end = start;
-               while (end->next())
-                       end = end->next();
-       }
        if (start && end && (start != end->next()) &&
            ((before_number != behind_number) ||
                 ((before_number < 0) && (behind_number < 0))))
@@ -361,11 +354,10 @@ bool createUndo(BufferView * bv, Undo::undo_kind kind,
                        tmppar2 = tmppar2->next();
                }
                tmppar2->next(0);
-       } else
-               undopar = 0; // nothing to replace (undo of delete maybe)
+       }
 
        int cursor_par = undoCursor(bv).par()->id();
-       int cursor_pos =  undoCursor(bv).pos();
+       int cursor_pos = undoCursor(bv).pos();
 
        u.reset(new Undo(kind, inset_id,
                before_number, behind_number,