]> git.lyx.org Git - features.git/commitdiff
* There are cases where updateLabels is not called because no
authorStefan Schimanski <sts@lyx.org>
Wed, 6 Feb 2008 11:21:42 +0000 (11:21 +0000)
committerStefan Schimanski <sts@lyx.org>
Wed, 6 Feb 2008 11:21:42 +0000 (11:21 +0000)
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

index c72ec7ae32be85068768ea9ade01cfa42de4975a..5c79d2c297e076cfce5df25681418a7bc393ab32 100644 (file)
@@ -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.