From 5f20d05b1b6335f731c1fc3fb9a87f70b698acbf Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Tue, 12 May 2015 15:47:38 +0200 Subject: [PATCH] Fix left margin with some nested layouts (#9538) --- src/TextMetrics.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index a347b993ec..da9e404cb0 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1610,12 +1610,16 @@ int TextMetrics::leftMargin(int max_width, l_margin += theFontMetrics(buffer.params().getFont()).signedWidth( tclass.leftmargin()); - if (par.getDepth() != 0) { + int depth = par.getDepth(); + if (depth != 0) { // find the next level paragraph pit_type newpar = text_->outerHook(pit); if (newpar != pit_type(pars.size())) { if (pars[newpar].layout().isEnvironment()) { - l_margin = leftMargin(max_width, newpar); + int nestmargin = depth * nestMargin(); + if (text_->isMainText()) + nestmargin += changebarMargin(); + l_margin = max(leftMargin(max_width, newpar), nestmargin); // Remove the parindent that has been added // if the paragraph was empty. if (pars[newpar].empty() &&