]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Attempt to fix bug #13017.
[lyx.git] / src / Buffer.cpp
index e837a9b55284ed282d5dcd51620c62c20a2f46b9..7522dce4343938d433bf26fed31bada34d1be385 100644 (file)
@@ -2422,7 +2422,7 @@ void Buffer::validate(LaTeXFeatures & features) const
 }
 
 
-void Buffer::getLabelList(vector<std::pair<docstring, docstring>> & list) const
+void Buffer::getLabelList(vector<std::tuple<docstring, docstring, docstring>> & list) const
 {
        // If this is a child document, use the master's list instead.
        if (parent()) {
@@ -2433,8 +2433,9 @@ void Buffer::getLabelList(vector<std::pair<docstring, docstring>> & list) const
        list.clear();
        shared_ptr<Toc> toc = d->toc_backend.toc("label");
        for (auto const & tocit : *toc) {
-               if (tocit.depth() == 0)
-                       list.push_back(make_pair(tocit.str(), tocit.asString()));
+               if (tocit.depth() == 0) {
+                       list.push_back(make_tuple(tocit.str(), tocit.asString(), tocit.prettyStr()));
+               }
        }
 }
 
@@ -2688,6 +2689,11 @@ bool Buffer::citeLabelsValid() const
 
 void Buffer::removeBiblioTempFiles() const
 {
+       if (theApp()->isBufferBusy(this)) {
+               removeBiblioTemps = true;
+               return;
+       }
+
        // We remove files that contain LaTeX commands specific to the
        // particular bibliographic style being used, in order to avoid
        // LaTeX errors when we switch style.
@@ -2701,6 +2707,7 @@ void Buffer::removeBiblioTempFiles() const
        Buffer const * const pbuf = parent();
        if (pbuf)
                pbuf->removeBiblioTempFiles();
+       removeBiblioTemps = false;
 }
 
 
@@ -5341,6 +5348,10 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
 
 void Buffer::updateBuffer(ParIterator & parit, UpdateType utype, bool const deleted) const
 {
+       // if fomatted references are shown in workarea update buffer accordingly
+       if (params().use_formatted_ref)
+               utype = OutputUpdate;
+
        pushIncludedBuffer(this);
        // LASSERT: Is it safe to continue here, or should we just return?
        LASSERT(parit.pit() == 0, /**/);
@@ -5710,15 +5721,24 @@ void Buffer::Impl::fileExternallyModified(bool const exists)
                       "checksum unchanged: " << filename);
                return;
        }
+       lyx_clean = false;
        // If the file has been deleted, only mark the file as dirty since it is
        // pointless to prompt for reloading. If later a file is moved into this
        // location, then the externally modified warning will appear then.
        if (exists)
-                       externally_modified_ = true;
+               externally_modified_ = true;
        // Update external modification notification.
        // Dirty buffers must be visible at all times.
-       if (wa_ && wa_->unhide(owner_))
+       if (wa_ && wa_->unhide(owner_)) {
                wa_->updateTitles();
+               if (!exists) {
+                       frontend::Alert::warning(
+                               _("File deleted from disk"),
+                               bformat(_("The file\n  %1$s\n"
+                                          "has been deleted from disk!"),
+                                       from_utf8(filename.absFileName())));
+               }
+       }
        else
                // Unable to unhide the buffer (e.g. no GUI or not current View)
                lyx_clean = true;