[LyX/master] Track change of label name
Juergen Spitzmueller
spitz at lyx.org
Sun Dec 29 09:45:06 UTC 2019
commit e65fdc6a51c03a51dced9f16dd30487607c50031
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sun Dec 29 11:01:18 2019 +0100
Track change of label name
Fixes #11556
---
src/insets/InsetLabel.cpp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index 6d5c0b6..bcb7290 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -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);
}
More information about the lyx-cvs
mailing list