From c0ef31d9b9816a81d00ae3f37625ff69e1be30ec Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 6 Dec 2017 09:11:18 +0100 Subject: [PATCH] Recreate citation label after paste Fixes: #10829 (cherry picked from commit 7e34e659431691fd723e408010f90973c0a25b39) --- src/CutAndPaste.cpp | 11 +++++++++++ src/insets/InsetCitation.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index f611d59395..57a8313957 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -40,6 +40,7 @@ #include "insets/InsetBibitem.h" #include "insets/InsetBranch.h" +#include "insets/InsetCitation.h" #include "insets/InsetCommand.h" #include "insets/InsetFlex.h" #include "insets/InsetGraphics.h" @@ -357,6 +358,16 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist, break; } + case CITE_CODE: { + InsetCitation & cit = static_cast(*it); + // This actually only needs to be done if the cite engine + // differs, but we do it in general. + cit.redoLabel(); + // We need to update the list of citations. + need_update = true; + break; + } + case BIBITEM_CODE: { // check for duplicates InsetBibitem & bib = static_cast(*it); diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index 992a85ee21..3e5e3baa35 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -82,6 +82,8 @@ public: static bool isCompatibleCommand(std::string const &); //@} /// + void redoLabel() { cache.recalculate = true; } + /// CitationStyle getCitationStyle(BufferParams const & bp, std::string const & input, std::vector const & valid_styles) const; ///