]> git.lyx.org Git - features.git/commitdiff
Fix bug #5890: Assertion when reducing the view size.
authorVincent van Ravesteijn <vfr@lyx.org>
Sat, 9 May 2009 20:26:04 +0000 (20:26 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sat, 9 May 2009 20:26:04 +0000 (20:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29597 a592a061-630c-0410-9148-cb99ea01b6c8

src/TextMetrics.cpp
src/insets/InsetText.cpp

index 6e22bf7852cb692a7a28309145b0da6bf0530bc2..3baf705c026725bcc7978197d1f92e2f658d6655 100644 (file)
@@ -187,7 +187,7 @@ int TextMetrics::parPosition(pit_type pit) const
 
 bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width)
 {
-       LASSERT(mi.base.textwidth, /**/);
+       LASSERT(mi.base.textwidth > 0, /**/);
        max_width_ = mi.base.textwidth;
        // backup old dimension.
        Dimension const old_dim = dim_;
index 73a209b5e2e9ae2668065877e5392fd5025ce958..5c461242e50605db652a460bfac7fdb5c4187341 100644 (file)
@@ -183,6 +183,13 @@ void InsetText::metrics(MetricsInfo & mi, Dimension & dim) const
        // Hand font through to contained lyxtext:
        tm.font_.fontInfo() = mi.base.font;
        mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
+
+       // This can happen when a layout has a left and right margin,
+       // and the view is made very narrow. We can't do better than 
+       // to draw it partly out of view (bug 5890).
+       if (mi.base.textwidth < 1)
+               mi.base.textwidth = 1;
+
        if (hasFixedWidth())
                tm.metrics(mi, dim, mi.base.textwidth);
        else
@@ -480,9 +487,9 @@ void InsetText::updateLabels(ParIterator const & it)
        ParIterator it2 = it;
        it2.forwardPos();
        LASSERT(&it2.inset() == this && it2.pit() == 0, return);
-       if (producesOutput()) {
+       if (producesOutput())
                buffer().updateLabels(it2);
-       else {
+       else {
                DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass();
                Counters const savecnt = tclass.counters();
                buffer().updateLabels(it2);