From 08d93755727228dd1a7140c9791463906bd94f83 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Wed, 6 Feb 2008 11:21:42 +0000 Subject: [PATCH] * There are cases where updateLabels is not called because no paragraph relayout happens (e.g. when inserting a InsetBranch, the InsetText inside was not processed by any updateLabels call), and hence the macrocontext is not always set. This should not happen often in fact. So we update the labels in that case explicitely when we see an empty macrocontext. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22807 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/TextMetrics.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index c72ec7ae32..5c79d2c297 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -379,7 +379,16 @@ bool TextMetrics::redoParagraph(pit_type const pit) DocIterator parPos = text_->macrocontextPosition(); if (!parPos.empty()) parPos.pit() = pit; - + else { + LYXERR(Debug::INFO, "MacroContext not initialised!" + << " Going through the buffer again and hope" + << " the context is better then."); + updateLabels(bv_->buffer()); + parPos = text_->macrocontextPosition(); + parPos.pit() = pit; + BOOST_ASSERT(!parPos.empty()); + } + // redo insets // FIXME: We should always use getFont(), see documentation of // noFontChange() in Inset.h.