From: Enrico Forestieri Date: Thu, 22 May 2014 21:47:38 +0000 (+0200) Subject: Fix another glitch with on-screen indentation. X-Git-Tag: 2.2.0alpha1~1906 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a596736d76c318f94c36135756b1d1376c042539;p=features.git Fix another glitch with on-screen indentation. If a new paragraph is created just before a nested environment, the indentation of the nested environment is not computed correctly because the parindent of the previous layout would also be erroneously taken into account. This would cause the nested environment to move back and forth when something is added to the new paragraph. --- diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 226f842081..de414ea44a 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1896,6 +1896,13 @@ int TextMetrics::leftMargin(int max_width, if (newpar != pit_type(pars.size())) { if (pars[newpar].layout().isEnvironment()) { l_margin = leftMargin(max_width, newpar); + // Remove the parindent that has been added + // if the paragraph was empty. + if (pars[newpar].empty()) { + docstring pi = pars[newpar].layout().parindent; + l_margin -= theFontMetrics( + buffer.params().getFont()).signedWidth(pi); + } } if (tclass.isDefaultLayout(par.layout()) || tclass.isPlainLayout(par.layout())) {