]> git.lyx.org Git - features.git/commitdiff
Fix bug 2746: http://bugzilla.lyx.org/show_bug.cgi?id=2746
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 17 Sep 2008 16:28:33 +0000 (16:28 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 17 Sep 2008 16:28:33 +0000 (16:28 +0000)
References autoupdate is not undone during UNDO operation

* InsetLabel.cpp (updateCommand): record undo for each of the label
changes (and put everything in a group to make sure it will be undone
in one step).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26432 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetLabel.cpp

index 2b95d62fa987a1bc86d130327711ebe21fd1d0ab..6a3be71a0205118378ba7de4ea5bcb578faf30e3 100644 (file)
@@ -66,15 +66,19 @@ void InsetLabel::updateCommand(docstring const & new_label, bool updaterefs)
                        "it will be changed to %2$s."), new_label, label));
        }
 
+       buffer().undo().beginUndoGroup();
        setParam("name", label);
 
        if (updaterefs) {
                Buffer::References & refs = buffer().references(old_label);
                Buffer::References::iterator it = refs.begin();
                Buffer::References::iterator end = refs.end();
-               for (; it != end; ++it)
+               for (; it != end; ++it) {
+                       buffer().undo().recordUndo(it->second);
                        it->first->setParam("reference", label);
+               }
        }
+       buffer().undo().endUndoGroup();
 
        // We need an update of the Buffer reference cache. This is achieved by
        // updateLabel().