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
This commit is contained in:
Jean-Marc Lasgouttes 2008-09-17 16:28:33 +00:00
parent 00c0933502
commit 32a3da1a84

View File

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