From 05f950bc39fcb80ffd5396b8a02a83dfec450a24 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Tue, 17 Nov 2020 01:08:35 -0500 Subject: [PATCH] Move dump code to after we are done --- src/Buffer.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 30f04d84eb..97b837fb23 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -3792,6 +3792,21 @@ void Buffer::updateMacros() const { if (d->macro_lock) return; + + // start with empty table + d->macro_table.clear(); + d->children_positions.clear(); + d->position_to_children.clear(); + + // Iterate over buffer, starting with first paragraph + // The scope must be bigger than any lookup DocIterator + // later. For the global lookup, lastpit+1 is used, hence + // we use lastpit+2 here. + DocIterator it = par_iterator_begin(); + DocIterator outerScope = it; + outerScope.pit() = outerScope.lastpit() + 2; + inset().updateMacros(it, outerScope); + #if 0 LYXERR0("Starting macro dump"); for (auto const & m : d->macros) { @@ -3807,20 +3822,6 @@ void Buffer::updateMacros() const LYXERR0(""); LYXERR(Debug::MACROS, "updateMacro of " << d->filename.onlyFileName()); #endif - - // start with empty table - d->macro_table.clear(); - d->children_positions.clear(); - d->position_to_children.clear(); - - // Iterate over buffer, starting with first paragraph - // The scope must be bigger than any lookup DocIterator - // later. For the global lookup, lastpit+1 is used, hence - // we use lastpit+2 here. - DocIterator it = par_iterator_begin(); - DocIterator outerScope = it; - outerScope.pit() = outerScope.lastpit() + 2; - inset().updateMacros(it, outerScope); } -- 2.39.5