]> 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>
Sun, 15 Apr 2018 04:29:36 +0000 (00:29 -0400)
See also https://marc.info/?l=lyx-devel&m=151709211602688&w=2.

(cherry picked from commit d3ee87eea282ca6e8f0a78bc6a0e27b4f0942624)

src/Buffer.cpp
src/Buffer.h
src/BufferView.cpp
src/LayoutModuleList.h
status.23x

index b3ce87f900f0057ed7b7287f1ffec37ae1bc142b..4d9973a89ccb943ab198f957a6a1c74a44c31c90 100644 (file)
@@ -2467,6 +2467,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 0e01dbc286716650e3f7273f6a425293a4015a96..048c875404c253d8c240b5b63defc4227642ed95 100644 (file)
@@ -519,6 +519,8 @@ public:
        ///
        void makeCitationLabels() const;
        ///
+       void invalidateCiteLabels() const;
+       ///
        bool citeLabelsValid() const;
        ///
        void getLabelList(std::vector<docstring> &) const;
index f1b5c378b631230779e0f1aa2a5aba5e84ecad1f..b1c995d4714f8f57ad61ee5d4614f6d6bf1e88da 100644 (file)
@@ -1367,25 +1367,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.
index 55128e96f7ffc2b6bfb37298f70fbf7bb56a3741..10e13fe8e6291b5fa44a833f9bc033e4b007fc8c 100644 (file)
@@ -196,6 +196,9 @@ What's new
 
 - Fix some master/child issues with biblatex (bug 11083).
 
+- Recalculate citation insets when bibliography info changes as a result
+  of undo or redo (bug 11005).
+
 
 * INTERNALS