]> git.lyx.org Git - features.git/commitdiff
Prettify the output of InsetSeparator.
authorEnrico Forestieri <forenr@lyx.org>
Sun, 18 May 2014 21:02:24 +0000 (23:02 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Sun, 18 May 2014 21:02:24 +0000 (23:02 +0200)
If a separator inset is used after an environment with NextNoIndent
set to false, a blank line was already output. So, avoid outputting
another blank line or an odd looking line with only a '%' character
(as the previous blank line provides already a visual separation).

src/insets/InsetSeparator.cpp

index ba985520795c567622948b363baddd6dfe56f6e4..eaf376f15e2c518ae96d60ea86d0706b6a5df335 100644 (file)
@@ -139,16 +139,19 @@ ColorCode InsetSeparator::ColorName() const
 
 void InsetSeparator::latex(otexstream & os, OutputParams const &) const
 {
-       switch (params_.kind) {
-               case InsetSeparatorParams::PLAIN:
-                       os << breakln << "%\n";
-                       break;
-               case InsetSeparatorParams::PARBREAK:
-                       os << breakln << "\n";
-                       break;
-               default:
-                       os << breakln << "%\n";
-                       break;
+       // Do nothing if a paragraph break was just output
+       if (!os.afterParbreak()) {
+               switch (params_.kind) {
+                       case InsetSeparatorParams::PLAIN:
+                               os << breakln << "%\n";
+                               break;
+                       case InsetSeparatorParams::PARBREAK:
+                               os << breakln << "\n";
+                               break;
+                       default:
+                               os << breakln << "%\n";
+                               break;
+               }
        }
 }