]> git.lyx.org Git - features.git/commitdiff
Fix bug #11055.
authorRichard Heck <rgheck@lyx.org>
Mon, 29 Jan 2018 04:33:45 +0000 (23:33 -0500)
committerRichard Heck <rgheck@lyx.org>
Mon, 29 Jan 2018 04:37:20 +0000 (23:37 -0500)
See also https://marc.info/?l=lyx-devel&m=151709211602688&w=2.

src/Buffer.cpp
src/Buffer.h
src/BufferView.cpp
src/LayoutModuleList.h

index 9442f237566eb23fb8c6eb6a60b1011ea55dfa66..ff85f2232cafa7295362ecbe79eb5c306eaffb6a 100644 (file)
@@ -2440,6 +2440,11 @@ void Buffer::makeCitationLabels() const
 }
 
 
+void Buffer::invalidateCiteLabels() const
+{
+       masterBuffer()->d->cite_labels_valid_ = false;
+}
+
 bool Buffer::citeLabelsValid() const
 {
        return masterBuffer()->d->cite_labels_valid_;
index 96fd8e25f8c43bd354b7618d552b9e493744e22c..d111c2ba3d3b0049c5066f52d2788ac1e2c09a8e 100644 (file)
@@ -517,6 +517,8 @@ public:
        ///
        void makeCitationLabels() const;
        ///
+       void invalidateCiteLabels() const;
+       ///
        bool citeLabelsValid() const;
        ///
        void getLabelList(std::vector<docstring> &) const;
index b64f36d8ab149549e446a9d872f1792590aabac3..7659f03cc2436a4c10a18e04c33ce959b49da56d 100644 (file)
@@ -1379,25 +1379,45 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                break;
        }
 
-       case LFUN_UNDO:
+       case LFUN_UNDO: {
                dr.setMessage(_("Undo"));
                cur.clearSelection();
+               // We need to find out if the bibliography information
+               // has changed. See bug #11055.
+               // So these should not be references...
+               LayoutModuleList const engines = buffer().params().citeEngine();
+               CiteEngineType const enginetype = buffer().params().citeEngineType();
                if (!cur.textUndo())
                        dr.setMessage(_("No further undo information"));
-               else
+               else {
                        dr.screenUpdate(Update::Force | Update::FitCursor);
-               dr.forceBufferUpdate();
+                       dr.forceBufferUpdate();
+                       if (buffer().params().citeEngine() != engines ||
+                           buffer().params().citeEngineType() != enginetype)
+                               buffer().invalidateCiteLabels();
+               }
                break;
+       }
 
-       case LFUN_REDO:
+       case LFUN_REDO: {
                dr.setMessage(_("Redo"));
                cur.clearSelection();
+               // We need to find out if the bibliography information
+               // has changed. See bug #11055.
+               // So these should not be references...
+               LayoutModuleList const engines = buffer().params().citeEngine();
+               CiteEngineType const enginetype = buffer().params().citeEngineType();
                if (!cur.textRedo())
                        dr.setMessage(_("No further redo information"));
-               else
+               else {
                        dr.screenUpdate(Update::Force | Update::FitCursor);
-               dr.forceBufferUpdate();
+                       dr.forceBufferUpdate();
+                       if (buffer().params().citeEngine() != engines ||
+                           buffer().params().citeEngineType() != enginetype)
+                               buffer().invalidateCiteLabels();
+               }
                break;
+       }
 
        case LFUN_FONT_STATE:
                dr.setMessage(cur.currentState(false));
index c56e5725725225890c596ab4e069ec6758894127..aa9925109d9c6ab25979d60e1bab419df79fd001 100644 (file)
@@ -75,6 +75,14 @@ public:
        /// to be made.
        bool adaptToBaseClass(LayoutFile const * const lay,
                        std::list<std::string> const & removedModules);
+       ///
+       bool operator==(LayoutModuleList const & other) const {
+               return lml_ == other.lml_;
+       }
+       ///
+       bool operator!=(LayoutModuleList const & other) const {
+               return !operator==(other);
+       }
 private:
        /// Removes modules excluded by, provided by, etc, the base class.
        /// \param lay The document class against which to check.