Author: forenr
Date: Wed Jun 22 22:48:02 2011
New Revision: 39194
URL: http://www.lyx.org/trac/changeset/39194

Log:
Fix bug #7645 (stream encoding not properly reset after a float)

Modified:
   lyx-devel/branches/BRANCH_2_0_X/src/Paragraph.cpp
   lyx-devel/branches/BRANCH_2_0_X/status.20x

Modified: lyx-devel/branches/BRANCH_2_0_X/src/Paragraph.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/Paragraph.cpp   Wed Jun 22 18:21:03 
2011        (r39193)
+++ lyx-devel/branches/BRANCH_2_0_X/src/Paragraph.cpp   Wed Jun 22 22:48:02 
2011        (r39194)
@@ -312,8 +312,8 @@
                              OutputParams const &) const;
 
        /// This could go to ParagraphParameters if we want to.
-       int endTeXParParams(BufferParams const &, otexstream &,
-                           OutputParams const &) const;
+       bool endTeXParParams(BufferParams const &, otexstream &,
+                            OutputParams const &) const;
 
        ///
        void latexInset(BufferParams const &,
@@ -2213,15 +2213,13 @@
 }
 
 
-int Paragraph::Private::endTeXParParams(BufferParams const & bparams,
+bool Paragraph::Private::endTeXParParams(BufferParams const & bparams,
                        otexstream & os, OutputParams const & runparams) const
 {
-       int column = 0;
-
        LyXAlignment const curAlign = params_.align();
 
        if (curAlign == layout_->align)
-               return column;
+               return false;
 
        switch (curAlign) {
        case LYX_ALIGN_NONE:
@@ -2233,13 +2231,12 @@
        case LYX_ALIGN_LEFT:
        case LYX_ALIGN_RIGHT:
        case LYX_ALIGN_CENTER:
-               if (runparams.moving_arg) {
+               if (runparams.moving_arg)
                        os << "\\protect";
-                       column = 8;
-               }
                break;
        }
 
+       string output;
        string const end_tag = "\n\\par\\end";
        InsetCode code = ownerCode();
        bool const lastpar = runparams.isLastPar;
@@ -2252,33 +2249,27 @@
        case LYX_ALIGN_DECIMAL:
                break;
        case LYX_ALIGN_LEFT: {
-               string output;
                if (owner_->getParLanguage(bparams)->babel() != "hebrew")
                        output = corrected_env(end_tag, "flushleft", code, 
lastpar);
                else
                        output = corrected_env(end_tag, "flushright", code, 
lastpar);
                os << from_ascii(output);
-               adjust_column(output, column);
                break;
        } case LYX_ALIGN_RIGHT: {
-               string output;
                if (owner_->getParLanguage(bparams)->babel() != "hebrew")
                        output = corrected_env(end_tag, "flushright", code, 
lastpar);
                else
                        output = corrected_env(end_tag, "flushleft", code, 
lastpar);
                os << from_ascii(output);
-               adjust_column(output, column);
                break;
        } case LYX_ALIGN_CENTER: {
-               string output;
                output = corrected_env(end_tag, "center", code, lastpar);
                os << from_ascii(output);
-               adjust_column(output, column);
                break;
        }
        }
 
-       return column;
+       return !output.empty() || lastpar;
 }
 
 

Modified: lyx-devel/branches/BRANCH_2_0_X/status.20x
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/status.20x  Wed Jun 22 18:21:03 2011        
(r39193)
+++ lyx-devel/branches/BRANCH_2_0_X/status.20x  Wed Jun 22 22:48:02 2011        
(r39194)
@@ -136,6 +136,8 @@
 
 - Fix incompatibility between jss.layout and Sweave (see bug 7555).
 
+- Fix LaTeX export when the file encoding changes after a float (bug 7645).
+
 * USER INTERFACE
 
 - Fixed crash relating to outliner and mouse movement.

Reply via email to