]> git.lyx.org Git - features.git/blobdiff - src/TextMetrics.cpp
Center correctly centered top labels (e.g. abstract)
[features.git] / src / TextMetrics.cpp
index 214fe89238d5868d7051ba943a4db59903415cc5..56d312f6a580695410404558c3edfa172b1a113b 100644 (file)
@@ -1610,7 +1610,10 @@ int TextMetrics::leftMargin(pit_type const pit, pos_type const pos) const
        LASSERT(pit < int(pars.size()), return 0);
        Paragraph const & par = pars[pit];
        LASSERT(pos >= 0, return 0);
-       LASSERT(pos <= par.size(), return 0);
+       // We do not really care whether pos > par.size(), since we do not
+       // access the data. It can be actially useful, when querying the
+       // margin without indentation (see RowPainter::paintTopLevelLabel).
+
        Buffer const & buffer = bv_->buffer();
        //lyxerr << "TextMetrics::leftMargin: pit: " << pit << " pos: " << pos << endl;
        DocumentClass const & tclass = buffer.params().documentClass();
@@ -1764,8 +1767,8 @@ int TextMetrics::leftMargin(pit_type const pit, pos_type const pos) const
            && !text_->inset().neverIndent()
            // display style insets do not need indentation
            && !(!par.empty()
-                && par.isInset(pos)
-                && par.getInset(pos)->rowFlags() & Inset::Display)
+                && par.isInset(0)
+                && par.getInset(0)->rowFlags() & Inset::Display)
            && (!(tclass.isDefaultLayout(par.layout())
                || tclass.isPlainLayout(par.layout()))
                || buffer.params().paragraph_separation