From: Juergen Spitzmueller Date: Fri, 3 Mar 2023 13:54:04 +0000 (+0100) Subject: Fix intitle context checking for info insets X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e6966647fdc6be358fe9f3415e0d12650683cc4f;p=features.git Fix intitle context checking for info insets --- diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index 46d656c817..123b1ee3b0 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -796,8 +796,12 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype, bool cons // in the original Buffer. This is especially important for VCS. // Otherwise, we could in principle have different settings here // than in the Buffer we were exporting. - if (buffer().isClone()) + // However, we need to check whether the inset is in an intitle + // context. + if (buffer().isClone()) { + InsetText::checkIntitleContext(it); return; + } BufferParams const & bp = buffer().params(); params_.lang = it.paragraph().getFontSettings(bp, it.pos()).language(); InsetCollapsible::updateBuffer(it, utype, deleted); diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 99324aaeaf..27b6a49b5a 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -1080,6 +1080,20 @@ bool InsetText::forceLocalFontSwitch() const } +void InsetText::checkIntitleContext(ParIterator const & it) +{ + intitle_context_ = it.paragraph().layout().intitle; + // Also check embedding layouts + size_t const n = it.depth(); + for (size_t i = 0; i < n; ++i) { + if (it[i].paragraph().layout().intitle) { + intitle_context_ = true; + break; + } + } +} + + void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted) { ParIterator it2 = it; @@ -1100,17 +1114,7 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool cons cnt.restoreLastLayout(); // FIXME cnt.restoreLastCounter()? } - // Record if this inset is embedded in a title layout - // This is needed to decide when \maketitle is output. - intitle_context_ = it.paragraph().layout().intitle; - // Also check embedding layouts - size_t const n = it.depth(); - for (size_t i = 0; i < n; ++i) { - if (it[i].paragraph().layout().intitle) { - intitle_context_ = true; - break; - } - } + checkIntitleContext(it); } else { DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass(); // Note that we do not need to call: diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index b9e2dc936e..bbff948c83 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -125,6 +125,9 @@ public: /// void fixParagraphsFont(); + /// Check and record if this inset is embedded in a title layout + /// This is needed to decide when \maketitle is output. + void checkIntitleContext(ParIterator const & it); /// does the inset contain changes ? bool isChanged() const override { return is_changed_; }