From 50f975f7db89dab2039aa3dd5373c55ba9d2c638 Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Thu, 12 Nov 2020 19:58:30 -0500 Subject: [PATCH] Fix iterator in InsetInclude to be as it was previously. --- src/insets/InsetInclude.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index eff6fb5bf6..79ecaec639 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -1405,8 +1405,15 @@ void InsetInclude::updateMacros(DocIterator const & us, DocIterator const & scop buffer().setMacroLock(); loadIfNeeded(); buffer().clearMacroLock(); - if (child_buffer_) - buffer().registerChild(child_buffer_, us, scope); + if (child_buffer_) { + // We want an iterator that just points at the location of this inset, + // whereas the one we were passed has us on top. + // At least, that is how the updateMacros code was before RKH modified + // it. That is not to say they quite understand why it was like that. + DocIterator it = us; + it.pop_back(); + buffer().registerChild(child_buffer_, it, scope); + } } -- 2.39.5