Author: forenr
Date: Tue Jan 25 00:58:58 2011
New Revision: 37320
URL: http://www.lyx.org/trac/changeset/37320

Log:
Fix bug #7254 (LyX may insert a blank line when ending an environment)
The quick solution is to output a % sign before \n. The better one
would be doing as in mathed, but it is not so straightforward.

Modified:
   lyx-devel/trunk/src/insets/InsetFloat.cpp
   lyx-devel/trunk/src/insets/InsetText.cpp

Modified: lyx-devel/trunk/src/insets/InsetFloat.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetFloat.cpp   Mon Jan 24 17:30:06 2011        
(r37319)
+++ lyx-devel/trunk/src/insets/InsetFloat.cpp   Tue Jan 25 00:58:58 2011        
(r37320)
@@ -386,8 +386,8 @@
        int const i = InsetText::latex(os, runparams);
 
        // The \n is used to force \end{<floatname>} to appear in a new line.
-       // In this case, we do not case if the current output line is empty.
-       os << "\n\\end{" << from_ascii(tmptype) << "}\n";
+       // Also in this case, we care that the current output line is not empty.
+       os << "%\n\\end{" << from_ascii(tmptype) << "}\n";
 
        return i + 4;
 }

Modified: lyx-devel/trunk/src/insets/InsetText.cpp
==============================================================================
--- lyx-devel/trunk/src/insets/InsetText.cpp    Mon Jan 24 17:30:06 2011        
(r37319)
+++ lyx-devel/trunk/src/insets/InsetText.cpp    Tue Jan 25 00:58:58 2011        
(r37320)
@@ -413,7 +413,7 @@
                if (il.latextype() == InsetLayout::COMMAND) {
                        os << "}";
                } else if (il.latextype() == InsetLayout::ENVIRONMENT) {
-                       os << "\n\\end{" << from_utf8(il.latexname()) << "}\n";
+                       os << "%\n\\end{" << from_utf8(il.latexname()) << "}\n";
                        rows += 2;
                }
        }

Reply via email to