commit f40adfd4862ccb6e4de3181780a6cc321a57f36d
Author: Enrico Forestieri <for...@lyx.org>
Date:   Sat May 24 02:12:56 2014 +0200

    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.
    
    A proper status line covering this change is already present.

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 9635388..96c34aa 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1892,6 +1892,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())) {

Reply via email to