]> git.lyx.org Git - features.git/commitdiff
Track change of label name
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 29 Dec 2019 10:01:18 +0000 (11:01 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 29 Dec 2019 10:01:18 +0000 (11:01 +0100)
Fixes #11556

src/insets/InsetLabel.cpp

index 6d5c0b6ddde9a1f1392772dbd52515caf5b0e4e2..bcb72904bb465b9527c5deae24e46869edf89bb9 100644 (file)
@@ -105,7 +105,16 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
        UndoGroupHelper ugh(&buffer());
        if (cursor)
                cursor->recordUndo();
-       setParam("name", label);
+       if (buffer().params().track_changes) {
+               // With change tracking, we insert a new label and
+               // delete the old one
+               InsetCommandParams p(LABEL_CODE, "label");
+               p["name"] = label;
+               string const data = InsetCommand::params2string(p);
+               lyx::dispatch(FuncRequest(LFUN_INSET_INSERT, data));
+               lyx::dispatch(FuncRequest(LFUN_CHAR_DELETE_FORWARD));
+       } else
+               setParam("name", label);
        updateReferences(old_label, label);
 }