]> git.lyx.org Git - features.git/commitdiff
duplicated code, ParIterator::operator=
authorAndré Pönitz <poenitz@gmx.net>
Thu, 22 May 2003 15:16:58 +0000 (15:16 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 22 May 2003 15:16:58 +0000 (15:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7002 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/iterators.C
src/iterators.h
src/undo_funcs.C

index a95d555b6b9d08957c83de6a9c669df55a6f321a..2daa04db5596e87a4f08e2b5f2e6a357d7a3ea04 100644 (file)
@@ -1,3 +1,10 @@
+
+2003-05-22  André Pönitz  <poenitz@gmx.net>
+
+       * undo_funcs.C: remove duplicated code
+
+       * iterator.[Ch]: operator=
+
 2003-05-22  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * tabular.C (SetMultiColumn): ws changes
index aa89cba5a83f3dc63daf9729faf395bd04c47bba..b268aaf65c3a715c76849062a0ebadb399e9d909 100644 (file)
@@ -88,6 +88,13 @@ ParIterator::ParIterator(ParIterator const & pi)
 {}
 
 
+void ParIterator::operator=(ParIterator const & pi)
+{
+       ParIterator tmp(pi);
+       pimpl_.swap(tmp.pimpl_);
+}
+
+
 ParIterator & ParIterator::operator++()
 {
        while (!pimpl_->positions.empty()) {
index 5cca3f717d6dc3e2fa4de25696a0a0467960c646..08bfb9b17686fbce9396a70eb6aa70e0b6a54cdf 100644 (file)
@@ -25,6 +25,8 @@ public:
        ///
        ParIterator(ParIterator const &);
        ///
+       void operator=(ParIterator const &);
+       ///
        ParIterator & operator++();
        ///
        ParagraphList::iterator operator*() const;
index 3d3f659c2e8c29d60859c3fd702688c0eef94629..85b81d4f4a5bb62ee330fbed74982f3c79d9000b 100644 (file)
@@ -123,7 +123,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
                }
                // this surprisingly fills the undo! (Andre')
                size_t par = 0;
-               //while (deletepar && deletepar != *behind) {
+               //while (deletepar && deletepar != *behind) 
                while (deletepar != *behind) {
                        deletelist.push_back(&*deletepar);
                        ++deletepar;
@@ -222,46 +222,29 @@ bool textHandleUndo(BufferView * bv, Undo & undo)
        ParIterator tmppar =
                bv->buffer()->getParFromID(undo.number_of_cursor_par);
 
-       if (it) {
-               if (tmppar != end) {
-                       LyXText * t;
-                       Inset * it = tmppar->inInset();
-                       if (it) {
-                               FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
-                               it->localDispatch(cmd);
-                               t = it->getLyXText(bv);
-                       } else {
-                               t = bv->text;
-                       }
-                       t->setCursorIntern(*tmppar, undo.cursor_pos);
-                       // Clear any selection and set the selection
-                       // cursor for an evt. new selection.
-                       t->clearSelection();
-                       t->selection.cursor = t->cursor;
-                       t->updateCounters();
-                       bv->fitCursor();
+       if (tmppar != end) {
+               LyXText * t;
+               Inset * it = tmppar->inInset();
+               if (it) {
+                       FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
+                       it->localDispatch(cmd);
+                       t = it->getLyXText(bv);
+               } else {
+                       t = bv->text;
                }
+               t->setCursorIntern(*tmppar, undo.cursor_pos);
+               // Clear any selection and set the selection
+               // cursor for an evt. new selection.
+               t->clearSelection();
+               t->selection.cursor = t->cursor;
+               t->updateCounters();
+       }
+
+       if (it) {
+               bv->fitCursor();
                bv->updateInset(it);
                bv->text->setCursorIntern(bv->text->cursor.par(),
                                          bv->text->cursor.pos());
-       } else {
-               if (tmppar != end) {
-                       LyXText * t;
-                       Inset * it = tmppar->inInset();
-                       if (it) {
-                               FuncRequest cmd(bv, LFUN_INSET_EDIT, "left");
-                               it->localDispatch(cmd);
-                               t = it->getLyXText(bv);
-                       } else {
-                               t = bv->text;
-                       }
-                       t->setCursorIntern(*tmppar, undo.cursor_pos);
-                       // Clear any selection and set the selection
-                       // cursor for an evt. new selection.
-                       t->clearSelection();
-                       t->selection.cursor = t->cursor;
-                       t->updateCounters();
-               }
        }
 
        // And here it's safe enough to delete all removed paragraphs.