]> git.lyx.org Git - lyx.git/blobdiff - src/TextMetrics.cpp
Fix bug #5131: Remember last file active.
[lyx.git] / src / TextMetrics.cpp
index 87459718de32baa02af5acfc25b2d6078fc38653..6e22bf7852cb692a7a28309145b0da6bf0530bc2 100644 (file)
@@ -985,8 +985,8 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
        InsetList::const_iterator ii = par.insetList().begin();
        InsetList::const_iterator iend = par.insetList().end();
        for ( ; ii != iend; ++ii) {
-               Dimension const & dim = pm.insetDimension(ii->inset);
                if (ii->pos >= first && ii->pos < end) {
+                       Dimension const & dim = pm.insetDimension(ii->inset);
                        maxasc  = max(maxasc,  dim.ascent());
                        maxdesc = max(maxdesc, dim.descent());
                }
@@ -1850,11 +1850,11 @@ int TextMetrics::leftMargin(int max_width,
 
        case MARGIN_FIRST_DYNAMIC:
                if (layout.labeltype == LABEL_MANUAL) {
-                       if (pos >= par.beginOfBody()) {
+                       // if we are at position 0, we are never in the body
+                       if (pos > 0 && pos >= par.beginOfBody())
                                l_margin += labelfont_metrics.signedWidth(layout.leftmargin);
-                       } else {
+                       else
                                l_margin += labelfont_metrics.signedWidth(layout.labelindent);
-                       }
                } else if (pos != 0
                           // Special case to fix problems with
                           // theorems (JMarc)