From: Richard Kimberly Heck Date: Thu, 12 Nov 2020 23:07:35 +0000 (-0500) Subject: Now just use the Inset::updateMacros method. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=426674045cd849e1a041473350f00dad74a430fb;p=features.git Now just use the Inset::updateMacros method. I did all this step by step so (a) I could check the output along the way and (b) so it will be easier to isolate problems if those should arise. --- diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 5776e16c4f..aeb99c0779 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -924,48 +924,13 @@ void InsetText::updateMacros(DocIterator const & us, DocIterator const & scope) // look for macros in each paragraph while (it.pit() <= lastpit) { Paragraph & par = it.paragraph(); - // iterate over the insets of the current paragraph for (auto const & insit : par.insetList()) { it.pos() = insit.pos; - - if (InsetText * itext = insit.inset->asInsetText()) { - // collect macros in inset - it.push_back(CursorSlice(*insit.inset)); - itext->updateMacros(it, ourscope); - it.pop_back(); - continue; - } - - if (InsetTabular * itext = insit.inset->asInsetTabular()) { - it.push_back(CursorSlice(*insit.inset)); - itext->updateMacros(it, ourscope); - it.pop_back(); - continue; - } - - // is it an external file? - if (insit.inset->lyxCode() == INCLUDE_CODE) { - insit.inset->updateMacros(it, ourscope); - continue; - } - - InsetMath * im = insit.inset->asInsetMath(); - if (im) { - InsetMathHull * hull = im->asHullInset(); - if (hull) - hull->updateMacros(it, ourscope); - } - - if (insit.inset->lyxCode() != MATHMACRO_CODE) - continue; - - // get macro data - InsetMathMacroTemplate * macroTemplate = - insit.inset->asInsetMath()->asMacroTemplate(); - macroTemplate->updateMacros(it, ourscope); + it.push_back(CursorSlice(*insit.inset)); + insit.inset->updateMacros(it, ourscope); + it.pop_back(); } - // next paragraph it.pit()++; it.pos() = 0;