[LyX/master] Fix intitle context checking for info insets

Juergen Spitzmueller spitz at lyx.org
Fri Mar 3 12:52:27 UTC 2023


commit e6966647fdc6be358fe9f3415e0d12650683cc4f
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Mar 3 14:54:04 2023 +0100

    Fix intitle context checking for info insets
---
 src/insets/InsetInfo.cpp |    6 +++++-
 src/insets/InsetText.cpp |   26 +++++++++++++++-----------
 src/insets/InsetText.h   |    3 +++
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp
index 46d656c..123b1ee 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 99324aa..27b6a49 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 b9e2dc9..bbff948 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_; }


More information about the lyx-cvs mailing list