]> git.lyx.org Git - features.git/commitdiff
Fix an on-screen representation glitch.
authorEnrico Forestieri <forenr@lyx.org>
Fri, 16 May 2014 19:58:21 +0000 (21:58 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 16 May 2014 19:58:21 +0000 (21:58 +0200)
If a layout has NextNoIndent set to true, the following paragraph
is not indented on screen. LyX checks the previous layout for that
style parameter to decide whether to indent or not. Of course,
what matters is the latex output and the on-screen representation
should match this output. Now, when a layout has NextNoIndent==true,
the latex output is correctly not indented, while the on-screen
representation may fail to match this output. This can occur when,
for example, a standard paragraph is nested in the previous layout,
because LyX would check the property of the nested layout instead
of the container layout. Thus, LyX should check the property of a
previous layout at the same depth for correctly deciding whether
a paragraph has to be indented or not.
See also http://www.lyx.org/trac/ticket/9055#comment:12 for an
example document where the previous scenario actually occurs.

src/TextMetrics.cpp
status.21x

index e122d6a6a1d74f005b66460fb9c8a45b33922811..9e3483932bafbbc9046ba50081e112600da346cd 100644 (file)
@@ -1903,12 +1903,13 @@ int TextMetrics::leftMargin(int max_width,
                }
        }
 
-       // This happens after sections in standard classes. The 1.3.x
-       // code compared depths too, but it does not seem necessary
-       // (JMarc)
-       if (tclass.isDefaultLayout(par.layout())
-           && pit > 0 && pars[pit - 1].layout().nextnoindent)
-               parindent.erase();
+       // 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();
+       }
 
        FontInfo const labelfont = text_->labelFont(par);
        FontMetrics const & labelfont_metrics = theFontMetrics(labelfont);
index 9f32d4f3c20de29ab3772cc74524ccc6749be866..5e7c88f26e33e912fc544d9b0dc0eb8971951b2c 100644 (file)
@@ -119,6 +119,8 @@ What's new
 
 - Fix problem with drawing of background in math when selection is active.
 
+- Fix wrong on-screen indentation of a paragraph occurring in some cases.
+
 
 * INTERNALS