Properly restore the file encoding after a LaTeX environment with local scope.

Fixes bug #5690: Hebrew file cannot be exported to dvi or pdf.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30848 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-08-03 18:31:20 +00:00
parent ca7b18a5db
commit 898c621b84
2 changed files with 13 additions and 5 deletions

View File

@ -1960,6 +1960,8 @@ bool Paragraph::latex(BufferParams const & bparams,
Change runningChange = Change(Change::UNCHANGED);
Encoding const * const prev_encoding = runparams.encoding;
texrow.start(id(), 0);
// if the paragraph is empty, the loop will not be entered at all
@ -2186,10 +2188,8 @@ bool Paragraph::latex(BufferParams const & bparams,
return_value = false;
}
if (allowcust) {
column += d->endTeXParParams(bparams, os, texrow,
runparams);
}
if (allowcust && d->endTeXParParams(bparams, os, texrow,runparams))
runparams.encoding = prev_encoding;
LYXERR(Debug::LATEX, "Paragraph::latex... done " << this);
return return_value;

View File

@ -121,6 +121,7 @@ TeXEnvironment(Buffer const & buf,
|| (priorpit->getDepth() == pit->getDepth()
&& priorpit->layout() != pit->layout()));
Encoding const * const prev_encoding = runparams.encoding;
Language const * const par_language = pit->getParLanguage(bparams);
Language const * const doc_language = bparams.language;
Language const * const prev_par_language =
@ -251,11 +252,14 @@ TeXEnvironment(Buffer const & buf,
os << "\\end{" << from_ascii(style.latexname()) << "}\n";
texrow.newline();
prev_env_language_ = par_language;
runparams.encoding = prev_encoding;
}
if (leftindent_open) {
os << "\\end{LyXParagraphLeftIndent}\n";
texrow.newline();
prev_env_language_ = par_language;
runparams.encoding = prev_encoding;
}
if (par != paragraphs.end())
@ -501,6 +505,8 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
}
}
Encoding const * const prev_encoding = runparams.encoding;
bool const useSetSpace = bparams.documentClass().provides("SetSpace");
if (pit->allowParagraphCustomization()) {
if (pit->params().startOfAppendix()) {
@ -582,8 +588,10 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
os << "\\" << from_ascii(font.latexSize()) << " \\par}";
} else if (need_par) {
os << "\\par}";
} else if (is_command)
} else if (is_command) {
os << '}';
runparams.encoding = prev_encoding;
}
bool pending_newline = false;
switch (style.latextype) {