From: Juergen Spitzmueller Date: Fri, 6 Mar 2020 12:23:01 +0000 (+0100) Subject: Tell updateBuffer whether an inset is deleted. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0b1ad3e41aa8f2537bfd33611f6b65abf4f33320;p=features.git Tell updateBuffer whether an inset is deleted. Fixes #11747 --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index e20c78a2fa..11241afa4e 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -5219,7 +5219,7 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const } -void Buffer::updateBuffer(ParIterator & parit, UpdateType utype) const +void Buffer::updateBuffer(ParIterator & parit, UpdateType utype, bool const deleted) const { // LASSERT: Is it safe to continue here, or should we just return? LASSERT(parit.pit() == 0, /**/); @@ -5265,7 +5265,7 @@ void Buffer::updateBuffer(ParIterator & parit, UpdateType utype) const // now the insets for (auto const & insit : parit->insetList()) { parit.pos() = insit.pos; - insit.inset->updateBuffer(parit, utype); + insit.inset->updateBuffer(parit, utype, deleted || parit->isDeleted(insit.pos)); changed |= insit.inset->isChanged(); } diff --git a/src/Buffer.h b/src/Buffer.h index 7b965de7c2..e717e463bd 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -738,7 +738,7 @@ public: /// \param output: whether we are preparing for output. void updateBuffer(UpdateScope scope, UpdateType utype) const; /// - void updateBuffer(ParIterator & parit, UpdateType utype) const; + void updateBuffer(ParIterator & parit, UpdateType utype, bool const deleted = false) const; /// Spellcheck starting from \p from. /// \p from initial position, will then points to the next misspelled diff --git a/src/insets/Inset.h b/src/insets/Inset.h index ab35584e12..457ff44cb9 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -560,7 +560,7 @@ public: /// Update the counters of this inset and of its contents. /// The boolean indicates whether we are preparing for output, e.g., /// of XHTML. - virtual void updateBuffer(ParIterator const &, UpdateType) {} + virtual void updateBuffer(ParIterator const &, UpdateType, bool const) {} /// Updates the inset's dialog virtual Buffer const * updateFrontend() const; diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index 5dd8644fa3..00484f791f 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -62,7 +62,7 @@ void InsetArgument::read(Lexer & lex) } -void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { bool const insetlayout = !it.paragraph().layout().hasArgs(); Layout::LaTeXArgMap const args = insetlayout ? @@ -157,7 +157,7 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype) } setButtonLabel(); - InsetCollapsible::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype, deleted); } diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h index 5c63702262..15d3b85fd2 100644 --- a/src/insets/InsetArgument.h +++ b/src/insets/InsetArgument.h @@ -48,7 +48,7 @@ public: /// docstring layoutName() const { return from_ascii("Argument"); } /// Update the label string of this inset - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void latex(otexstream &, OutputParams const &) const { } /// diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp index 1c1962c0e6..c70e92ea73 100644 --- a/src/insets/InsetBibitem.cpp +++ b/src/insets/InsetBibitem.cpp @@ -327,7 +327,7 @@ void InsetBibitem::collectBibKeys(InsetIterator const & it, FileNameList & /*che // Update the counters of this inset and of its contents -void InsetBibitem::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetBibitem::updateBuffer(ParIterator const & it, UpdateType utype, bool const /*deleted*/) { BufferParams const & bp = buffer().masterBuffer()->params(); Counters & counters = bp.documentClass().counters(); diff --git a/src/insets/InsetBibitem.h b/src/insets/InsetBibitem.h index ba33732ad0..eda3a4626f 100644 --- a/src/insets/InsetBibitem.h +++ b/src/insets/InsetBibitem.h @@ -62,7 +62,7 @@ public: /// void collectBibKeys(InsetIterator const &, support::FileNameList &) const; /// update the counter of this inset - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); ///@} /// \name Static public methods obligated for InsetCommand derived classes diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 5ed6ff3d42..e2b88ca1a9 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -899,7 +899,7 @@ void InsetBibtex::validate(LaTeXFeatures & features) const } -void InsetBibtex::updateBuffer(ParIterator const &, UpdateType) +void InsetBibtex::updateBuffer(ParIterator const &, UpdateType, bool const /*deleted*/) { buffer().registerBibfiles(getBibFiles()); // record encoding of bib files for biblatex diff --git a/src/insets/InsetBibtex.h b/src/insets/InsetBibtex.h index fd447f8cb3..a46619367b 100644 --- a/src/insets/InsetBibtex.h +++ b/src/insets/InsetBibtex.h @@ -55,7 +55,7 @@ public: int plaintext(odocstringstream & ods, OutputParams const & op, size_t max_length = INT_MAX) const; /// - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 6afa0c72ea..ad7cbc5cdc 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -402,10 +402,10 @@ void InsetBranch::string2params(string const & in, InsetBranchParams & params) } -void InsetBranch::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetBranch::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { setLabel(params_.branch + (params_.inverted ? " (-)" : "")); - InsetCollapsible::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype, deleted); } diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h index 6ac8a67440..be926d99f5 100644 --- a/src/insets/InsetBranch.h +++ b/src/insets/InsetBranch.h @@ -88,7 +88,7 @@ private: /// std::string contextMenuName() const; /// - void updateBuffer(ParIterator const & it, UpdateType utype); + void updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted = false); /** \returns true if params_.branch is listed as 'selected' in \c buffer. \p child only checks within child documents. diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index 43147ff864..6b20876b5b 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -369,7 +369,7 @@ docstring InsetCaption::getCaptionAsHTML(XHTMLStream & xs, } -void InsetCaption::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetCaption::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { Buffer const & master = *buffer().masterBuffer(); DocumentClass const & tclass = master.params().documentClass(); @@ -406,10 +406,14 @@ void InsetCaption::updateBuffer(ParIterator const & it, UpdateType utype) docstring const labelstring = isAscii(lstring) ? master.B_(to_ascii(lstring)) : lstring; if (cnts.hasCounter(counter)) { + int val = cnts.value(counter); // for longtables, we step the counter upstream if (!cnts.isLongtable()) cnts.step(counter, utype); sec = cnts.theCounter(counter, lang); + if (deleted && !cnts.isLongtable()) + // un-step after deleted counter + cnts.set(counter, val); } if (labelstring != master.B_("standard")) { if (!sec.empty()) @@ -423,7 +427,7 @@ void InsetCaption::updateBuffer(ParIterator const & it, UpdateType utype) } // Do the real work now. - InsetText::updateBuffer(it, utype); + InsetText::updateBuffer(it, utype, deleted); if (utype == OutputUpdate) cnts.restoreLastCounter(); } diff --git a/src/insets/InsetCaption.h b/src/insets/InsetCaption.h index 6cd6aa417d..a1d14659fb 100644 --- a/src/insets/InsetCaption.h +++ b/src/insets/InsetCaption.h @@ -69,7 +69,7 @@ private: /// bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; // Update the counters of this inset and of its contents - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted); /// void latex(otexstream & os, OutputParams const &) const; /// diff --git a/src/insets/InsetCaptionable.cpp b/src/insets/InsetCaptionable.cpp index 467106fa43..1a2e5f0670 100644 --- a/src/insets/InsetCaptionable.cpp +++ b/src/insets/InsetCaptionable.cpp @@ -114,7 +114,7 @@ void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active, b.pop(); } -void InsetCaptionable::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetCaptionable::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { Counters & cnts = buffer().masterBuffer()->params().documentClass().counters(); @@ -131,7 +131,7 @@ void InsetCaptionable::updateBuffer(ParIterator const & it, UpdateType utype) // Tell captions what the current float is cnts.current_float(caption_type_); cnts.isSubfloat(subflt); - InsetCollapsible::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype, deleted); // Restore counters cnts.current_float(saveflt); if (utype == OutputUpdate) diff --git a/src/insets/InsetCaptionable.h b/src/insets/InsetCaptionable.h index 8d0b486bcf..870489888c 100644 --- a/src/insets/InsetCaptionable.h +++ b/src/insets/InsetCaptionable.h @@ -45,7 +45,7 @@ protected: void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; /// Update the counters of this inset and of its contents - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// bool insetAllowed(InsetCode) const; private: diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 1071d5280e..7285009b89 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -463,7 +463,7 @@ docstring InsetCitation::screenLabel() const } -void InsetCitation::updateBuffer(ParIterator const &, UpdateType) +void InsetCitation::updateBuffer(ParIterator const &, UpdateType, bool const /*deleted*/) { if (!cache.recalculate && buffer().citeLabelsValid()) return; diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index 9ac4e0bbd1..b2a738cd9e 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -64,7 +64,7 @@ public: /// void forOutliner(docstring &, size_t const, bool const) const; /// - void updateBuffer(ParIterator const & it, UpdateType); + void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false); /// void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp index 05c48f68ec..c91d65ec37 100644 --- a/src/insets/InsetFlex.cpp +++ b/src/insets/InsetFlex.cpp @@ -140,7 +140,7 @@ void InsetFlex::doDispatch(Cursor & cur, FuncRequest & cmd) } -void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { BufferParams const & bp = buffer().masterBuffer()->params(); InsetLayout const & il = getLayout(); @@ -167,7 +167,7 @@ void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype) // need a layout flag cnts.saveLastCounter(); } - InsetCollapsible::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype, deleted); if (save_counter) cnts.restoreLastCounter(); } diff --git a/src/insets/InsetFlex.h b/src/insets/InsetFlex.h index 0844246769..f4d091a127 100644 --- a/src/insets/InsetFlex.h +++ b/src/insets/InsetFlex.h @@ -44,7 +44,7 @@ public: /// void doDispatch(Cursor & cur, FuncRequest & cmd); /// - void updateBuffer(ParIterator const & it, UpdateType utype); + void updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted = false); protected: /// diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index 3331184887..5b1152754c 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -49,7 +49,7 @@ docstring InsetFoot::layoutName() const } -void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { BufferParams const & bp = buffer().masterBuffer()->params(); Counters & cnts = bp.documentClass().counters(); @@ -94,7 +94,7 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype) custom_label_ += ' ' + from_ascii("#"); setLabel(custom_label_); - InsetCollapsible::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype, deleted); if (utype == OutputUpdate) cnts.restoreLastCounter(); } diff --git a/src/insets/InsetFoot.h b/src/insets/InsetFoot.h index 04e03fde7b..194661a9b2 100644 --- a/src/insets/InsetFoot.h +++ b/src/insets/InsetFoot.h @@ -39,7 +39,7 @@ private: /// void validate(LaTeXFeatures & features) const; /// Update the counters of this inset and of its contents - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// docstring toolTip(BufferView const & bv, int x, int y) const; /// diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 09d4be3cc7..9912695c36 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -1373,7 +1373,7 @@ void InsetInclude::updateCommand() } -void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { file_exist_ = includedFileExist(); @@ -1388,7 +1388,7 @@ void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype) return; if (label_) - label_->updateBuffer(it, utype); + label_->updateBuffer(it, utype, deleted); InsetListingsParams const par(to_utf8(params()["lstparams"])); if (par.getParamValue("caption").empty()) { diff --git a/src/insets/InsetInclude.h b/src/insets/InsetInclude.h index 69c778e272..6ba8b63982 100644 --- a/src/insets/InsetInclude.h +++ b/src/insets/InsetInclude.h @@ -104,7 +104,7 @@ public: void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; /// - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// std::string contextMenuName() const; //@} diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index f3fafce60b..5e375e9fdb 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -576,7 +576,7 @@ bool InsetPrintIndex::getStatus(Cursor & cur, FuncRequest const & cmd, } -void InsetPrintIndex::updateBuffer(ParIterator const &, UpdateType) +void InsetPrintIndex::updateBuffer(ParIterator const &, UpdateType, bool const /*deleted*/) { Index const * index = buffer().masterParams().indiceslist().findShortcut(getParam("type")); diff --git a/src/insets/InsetIndex.h b/src/insets/InsetIndex.h index 01bf7096b0..504eb84720 100644 --- a/src/insets/InsetIndex.h +++ b/src/insets/InsetIndex.h @@ -111,7 +111,7 @@ public: /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// - void updateBuffer(ParIterator const & it, UpdateType); + void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false); /// std::string contextMenuName() const; /// Updates needed features for this inset. diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index f0f731bff2..db64a2d366 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -749,7 +749,7 @@ bool InsetInfo::forceLTR(OutputParams const &) const } -void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) { +void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { // If the Buffer is a clone, then we neither need nor want to do any // of what follows. We want, rather, just to inherit how things were // in the original Buffer. This is especially important for VCS. @@ -1168,7 +1168,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) { // Just to do something with that string LYXERR(Debug::INFO, "info inset text: " << gui); - InsetCollapsible::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype, deleted); } diff --git a/src/insets/InsetInfo.h b/src/insets/InsetInfo.h index fa3cfda728..bed5744a48 100644 --- a/src/insets/InsetInfo.h +++ b/src/insets/InsetInfo.h @@ -200,7 +200,7 @@ public: /// void setInfo(std::string const & info); /// - void updateBuffer(ParIterator const & it, UpdateType utype); + void updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted = false); /// docstring toolTip(BufferView const & bv, int x, int y) const; /// diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp index 897b73f61e..7850e5e838 100644 --- a/src/insets/InsetLabel.cpp +++ b/src/insets/InsetLabel.cpp @@ -161,7 +161,7 @@ docstring InsetLabel::screenLabel() const } -void InsetLabel::updateBuffer(ParIterator const & par, UpdateType utype) +void InsetLabel::updateBuffer(ParIterator const & par, UpdateType utype, bool const /*deleted*/) { docstring const & label = getParam("name"); diff --git a/src/insets/InsetLabel.h b/src/insets/InsetLabel.h index ef4fed9cac..ab54e5e959 100644 --- a/src/insets/InsetLabel.h +++ b/src/insets/InsetLabel.h @@ -57,7 +57,7 @@ public: /// docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - void updateBuffer(ParIterator const & it, UpdateType); + void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false); /// void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index d34efa48cd..f7045c8131 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -989,7 +989,7 @@ void InsetQuotes::forOutliner(docstring & os, size_t const, bool const) const } -void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/) +void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/, bool const /*deleted*/) { BufferParams const & bp = buffer().masterBuffer()->params(); Font const & font = it.paragraph().getFontSettings(bp, it.pos()); diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h index 362a0e2dfa..ea33b0eea0 100644 --- a/src/insets/InsetQuotes.h +++ b/src/insets/InsetQuotes.h @@ -154,7 +154,7 @@ public: void forOutliner(docstring &, size_t const maxlen, bool const) const; /// Update the contextual information of this inset - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void validate(LaTeXFeatures &) const; diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index de0a531e9c..fbcea45105 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -398,7 +398,7 @@ void InsetRef::forOutliner(docstring & os, size_t const, bool const) const } -void InsetRef::updateBuffer(ParIterator const & it, UpdateType) +void InsetRef::updateBuffer(ParIterator const & it, UpdateType, bool const /*deleted*/) { docstring const & ref = getParam("reference"); // register this inset into the buffer reference cache. diff --git a/src/insets/InsetRef.h b/src/insets/InsetRef.h index 37a7c3ec3c..91c9244510 100644 --- a/src/insets/InsetRef.h +++ b/src/insets/InsetRef.h @@ -73,7 +73,7 @@ public: /// void validate(LaTeXFeatures & features) const; /// - void updateBuffer(ParIterator const & it, UpdateType); + void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false); /// void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 7b4db19173..e1ee36d676 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -4693,7 +4693,7 @@ void InsetTabular::edit(Cursor & cur, bool front, EntryDirection) } -void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetTabular::updateBuffer(ParIterator const & it, UpdateType utype, bool const /*deleted*/) { // In a longtable, tell captions what the current float is Counters & cnts = buffer().masterBuffer()->params().documentClass().counters(); diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 067141edd1..3e8a6bcfab 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -1037,7 +1037,7 @@ public: /// can we go further down on mouse click? bool descendable(BufferView const &) const { return true; } /// Update the counters of this inset and of its contents - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 47b9fc3a48..3d7de487f6 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -815,7 +815,7 @@ bool InsetText::insetAllowed(InsetCode code) const } -void InsetText::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { ParIterator it2 = it; it2.forwardPos(); @@ -829,7 +829,7 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype) cnt.clearLastLayout(); // FIXME cnt.saveLastCounter()? } - buffer().updateBuffer(it2, utype); + buffer().updateBuffer(it2, utype, deleted); if (save_layouts) { // LYXERR0("Exiting " << name()); cnt.restoreLastLayout(); @@ -845,7 +845,7 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype) // we need float information even in note insets (#9760) tclass.counters().current_float(savecnt.current_float()); tclass.counters().isSubfloat(savecnt.isSubfloat()); - buffer().updateBuffer(it2, utype); + buffer().updateBuffer(it2, utype, deleted); tclass.counters() = move(savecnt); } } diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index 3e535cb3c7..6c9790b135 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -172,7 +172,7 @@ public: { return getLayout().forcelocalfontswitch(); } /// Update the counters of this inset and of its contents - virtual void updateBuffer(ParIterator const &, UpdateType); + virtual void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void setMacrocontextPositionRecursive(DocIterator const & pos); /// diff --git a/src/insets/InsetWrap.cpp b/src/insets/InsetWrap.cpp index b06ea4f700..fe56091a75 100644 --- a/src/insets/InsetWrap.cpp +++ b/src/insets/InsetWrap.cpp @@ -127,9 +127,9 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd, } -void InsetWrap::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetWrap::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { - InsetCaptionable::updateBuffer(it, utype); + InsetCaptionable::updateBuffer(it, utype, deleted); } diff --git a/src/insets/InsetWrap.h b/src/insets/InsetWrap.h index 588a3bc1e1..3bf837876a 100644 --- a/src/insets/InsetWrap.h +++ b/src/insets/InsetWrap.h @@ -82,7 +82,7 @@ private: /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// Update the label - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void doDispatch(Cursor & cur, FuncRequest & cmd); /// diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 34fb53dcee..bd9088fb02 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -767,12 +767,12 @@ void InsetMathGrid::drawT(TextPainter & /*pain*/, int /*x*/, int /*y*/) const } -void InsetMathGrid::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetMathGrid::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { // pass down for (idx_type idx = 0; idx < nargs(); ++idx) if (cellinfo_[idx].multi != CELL_PART_OF_MULTICOLUMN) - cell(idx).updateBuffer(it, utype); + cell(idx).updateBuffer(it, utype, deleted); } diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index 425a98a324..89c8e7f079 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -113,7 +113,7 @@ public: /// void drawT(TextPainter & pi, int x, int y) const; /// - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// extract number of columns from alignment string static col_type guessColumns(docstring const & halign); /// accepts some LaTeX column codes: p,m,!,@,M,<,> diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index b15594e19a..7754e4dcd6 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -279,7 +279,7 @@ namespace { } // namespace -void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { if (!buffer_) { //FIXME: buffer_ should be set at creation for this inset! Problem is @@ -327,10 +327,10 @@ void InsetMathHull::updateBuffer(ParIterator const & it, UpdateType utype) // now the labels for (size_t i = 0; i != label_.size(); ++i) { if (label_[i]) - label_[i]->updateBuffer(it, utype); + label_[i]->updateBuffer(it, utype, deleted); } // pass down - InsetMathGrid::updateBuffer(it, utype); + InsetMathGrid::updateBuffer(it, utype, deleted); } diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 672685d0ba..9c27e0e374 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -49,7 +49,7 @@ public: /// void setBuffer(Buffer &); /// - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void addToToc(DocIterator const & di, bool output_active, UpdateType utype, TocBackend & backend) const; diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 4f6d150d32..907d7d4608 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -185,10 +185,10 @@ void InsetMathNest::cellsMetrics(MetricsInfo const & mi) const } -void InsetMathNest::updateBuffer(ParIterator const & it, UpdateType utype) +void InsetMathNest::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { for (idx_type i = 0, n = nargs(); i != n; ++i) - cell(i).updateBuffer(it, utype); + cell(i).updateBuffer(it, utype, deleted); } diff --git a/src/mathed/InsetMathNest.h b/src/mathed/InsetMathNest.h index a009bd3234..703d2d879d 100644 --- a/src/mathed/InsetMathNest.h +++ b/src/mathed/InsetMathNest.h @@ -38,7 +38,7 @@ public: /// draw background if locked void draw(PainterInfo & pi, int x, int y) const; /// - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// identifies NestInsets InsetMathNest * asNestInset() { return this; } /// identifies NestInsets diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index 9bfd558fe2..a2b044cac0 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -386,12 +386,12 @@ int MathData::kerning(BufferView const * bv) const } -void MathData::updateBuffer(ParIterator const & it, UpdateType utype) +void MathData::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { // pass down for (size_t i = 0, n = size(); i != n; ++i) { MathAtom & at = operator[](i); - at.nucleus()->updateBuffer(it, utype); + at.nucleus()->updateBuffer(it, utype, deleted); } } diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h index 3c93421821..fa6e80d31b 100644 --- a/src/mathed/MathData.h +++ b/src/mathed/MathData.h @@ -178,7 +178,7 @@ public: /// stay visually at the same position (cur==0 is allowed) void updateMacros(Cursor * cur, MacroContext const & mc, UpdateType, int nesting); /// - void updateBuffer(ParIterator const &, UpdateType); + void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false); /// void setBuffer(Buffer & b);