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
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.