]> git.lyx.org Git - features.git/commitdiff
Another fix to Undo/Redo code I hope we get nearer to perfection ;)
authorJürgen Vigna <jug@sad.it>
Fri, 4 Jan 2002 16:03:53 +0000 (16:03 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 4 Jan 2002 16:03:53 +0000 (16:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3296 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView2.C
src/ChangeLog
src/insets/ChangeLog
src/insets/insettext.C
src/lyxfunc.C
src/text2.C

index af1326aa034e21b578feebe2ef833a29d5deb40d..cf53e9b2ee8d3c94e79ea8d248b2c1d088326060 100644 (file)
@@ -437,6 +437,7 @@ bool BufferView::lockInset(UpdatableInset * inset)
                                par->inset_iterator_end();
                        for (; it != end; ++it) {
                                if ((*it) == inset) {
+                                       text->setCursorIntern(this, par, it.getPos());
                                        theLockingInset(inset);
                                        return true;
                                }
index 1551469e02746a6b937f6db612e88b3dd950d79f..259603b7e85883494faedc123626e4fafa348d2f 100644 (file)
@@ -1,3 +1,9 @@
+2002-01-04  Juergen Vigna  <jug@sad.it>
+
+       * BufferView2.C (lockInset): forgot to set a cursor.
+
+       * lyxfunc.C (dispatch): add a finishUndo() in LFUN_ESCAPE.
+
 2002-01-03     Martin Vermeer <martin.vermeer@hut.fi>
 
        * FormMathsPanel.C:
index 5630c00d2ac21f3f3e5870b80e92c4b4199cd072..35430b74800da40dbe25a191c04d5cb0b8b26447 100644 (file)
@@ -1,3 +1,12 @@
+2002-01-04  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C (lockInsetInInset): forgot to set a cursor.
+
+2002-01-02  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C (insertInset): make the correct undo informations on
+       inserting new insets.
+
 2001-12-31  John Levon  <moz@compsoc.man.ac.uk>
 
        * insettabular.C: correct single-cell select vertically
index 9a7a228112acdde69b1f57aa065518f376eb67c8..ba4966ab23669fbd144e314f362c82b38cd1e52b 100644 (file)
@@ -784,6 +784,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
                                        return true;
                                }
                                if ((*it)->getInsetFromID(id)) {
+                                       getLyXText(bv)->setCursorIntern(bv, p, it.getPos());
                                        lockInset(bv, static_cast<UpdatableInset *>(*it));
                                        return the_locking_inset->lockInsetInInset(bv, inset);
                                }
@@ -814,7 +815,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
 
 
 bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
-                                  bool lr)
+                                   bool lr)
 {
        if (!the_locking_inset)
                return false;
@@ -1810,19 +1811,21 @@ bool InsetText::insertInset(BufferView * bv, Inset * inset)
                        return the_locking_inset->insertInset(bv, inset);
                return false;
        }
-       inset->setOwner(this);
-       hideInsetCursor(bv);
-
        bool clear = false;
        if (!lt) {
                lt = getLyXText(bv);
                clear = true;
        }
+       setUndo(bv, Undo::FINISH, lt->cursor.par(), lt->cursor.par()->next());
+       freezeUndo();
+       inset->setOwner(this);
+       hideInsetCursor(bv);
        lt->insertInset(bv, inset);
        bv->fitCursor();
        if (clear)
                lt = 0;
        updateLocal(bv, CURSOR_PAR|CURSOR, true);
+       unFreezeUndo();
        return true;
 }
 
index 34eaec042ea2ab6c60c6e66e289f2019c2e8b25d..0456ef8bd14433fc78f9389885c5c0a5e0c7eacd 100644 (file)
@@ -930,7 +930,6 @@ string const LyXFunc::dispatch(int ac,
        case LFUN_ESCAPE:
        {
                if (!owner->view()->available()) break;
-               
                // this function should be used always [asierra060396]
                UpdatableInset * tli =
                        owner->view()->theLockingInset();
@@ -947,6 +946,7 @@ string const LyXFunc::dispatch(int ac,
                                                        lock,
                                                        true);
                        }
+                       finishUndo();
                }
        }
        break;
index e86a6e6cf43f3685dc5580515d9f3a3f304df29d..19ad0bdc1d4517f45c1b2bef7c94a0bc73ffeeb1 100644 (file)
@@ -1684,8 +1684,8 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
 {
        if (!cursor.par()->insetAllowed(inset->lyxCode()))
                return;
-       setUndo(bview, Undo::INSERT,
-               cursor.par(), cursor.par()->next());
+       // I don't know if this is necessary here (Jug 20020102)
+       setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next());
        cursor.par()->insertInset(cursor.pos(), inset);
        // Just to rebreak and refresh correctly.
        // The character will not be inserted a second time