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

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39193 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2011-06-22 16:21:03 +00:00
parent e79e40f26c
commit 5e534a7d84

View File

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