]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetLabel.cpp
The last commit was, uhh, not what I intended.
[lyx.git] / src / insets / InsetLabel.cpp
index 55ab479fa2efd38e829090ba2d722818a7c29fe8..6a3be71a0205118378ba7de4ea5bcb578faf30e3 100644 (file)
@@ -28,9 +28,9 @@
 #include "frontends/alert.h"
 
 #include "support/convert.h"
-#include "support/lyxalgo.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
+#include "support/lyxalgo.h"
 
 using namespace std;
 using namespace lyx::support;
@@ -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().