]> git.lyx.org Git - lyx.git/commitdiff
Fix wrong indentation on screen.
authorEnrico Forestieri <forenr@lyx.org>
Wed, 21 May 2014 19:47:01 +0000 (21:47 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Wed, 21 May 2014 19:47:01 +0000 (21:47 +0200)
LyX fails to indent on screen a standard paragraph when it is
nested into an environment. The fix is a one-liner but the diff
is larger because it also fixes a previous wrong indentantion
in the source ;)

src/TextMetrics.cpp

index 0be9058fa3f6b811d027b9bf8cf7b877c3828afd..226f842081b99a9705188fda1aec7f28312aeb3f 100644 (file)
@@ -1909,10 +1909,11 @@ int TextMetrics::leftMargin(int max_width,
 
        // This happens after sections or environments in standard classes.
        // We have to check the previous layout at same depth.
-       if (tclass.isDefaultLayout(par.layout()) && pit > 0) {
-           pit_type prev = text_->depthHook(pit, par.getDepth());
-           if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent)
-                   parindent.erase();
+       if (tclass.isDefaultLayout(par.layout()) && pit > 0
+           && pars[pit - 1].getDepth() >= par.getDepth()) {
+               pit_type prev = text_->depthHook(pit, par.getDepth());
+               if (pars[prev < pit ? prev : pit - 1].layout().nextnoindent)
+                       parindent.erase();
        }
 
        FontInfo const labelfont = text_->labelFont(par);