From 36bf21c493ceb4522559760d2ad808d1032b9e58 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Thu, 12 Nov 2020 18:07:35 -0500 Subject: [PATCH] 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. --- src/insets/InsetText.cpp | 41 +++------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 6585586a78..ee04ee330f 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -926,48 +926,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; -- 2.39.5