diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp index 15843c18fd..80d46ab750 100644 --- a/src/insets/InsetLabel.cpp +++ b/src/insets/InsetLabel.cpp @@ -100,17 +100,20 @@ void InsetLabel::getLabelList(vector & list) const docstring InsetLabel::screenLabel() const { - return getParam("name"); + return screen_label_; } void InsetLabel::updateLabels(ParIterator const &) { docstring const & label = getParam("name"); - if (buffer().insetLabel(label)) + if (buffer().insetLabel(label)) { // Problem: We already have an InsetLabel with the same name! + screen_label_ = _("DUPLICATE: ") + label; return; + } buffer().setInsetLabel(label, this); + screen_label_ = label; } @@ -119,10 +122,10 @@ void InsetLabel::addToToc(ParConstIterator const & cpit) const docstring const & label = getParam("name"); Toc & toc = buffer().tocBackend().toc("label"); if (buffer().insetLabel(label) != this) { - toc.push_back(TocItem(cpit, 0, _("DUPLICATE: ") + label)); + toc.push_back(TocItem(cpit, 0, screen_label_)); return; } - toc.push_back(TocItem(cpit, 0, label)); + toc.push_back(TocItem(cpit, 0, screen_label_)); Buffer::References const & refs = buffer().references(label); Buffer::References::const_iterator it = refs.begin(); Buffer::References::const_iterator end = refs.end(); diff --git a/src/insets/InsetLabel.h b/src/insets/InsetLabel.h index 7fe8a0c290..ca86840045 100644 --- a/src/insets/InsetLabel.h +++ b/src/insets/InsetLabel.h @@ -61,6 +61,8 @@ protected: private: /// Inset * clone() const { return new InsetLabel(*this); } + /// + docstring screen_label_; };