From be3e470068d29d01fc14a7240ac8b1d6b2ac8024 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Mon, 19 Oct 2015 21:08:01 +0200 Subject: [PATCH] Fix language nesting regression b1c68dccf8f and 46aed6d2b90 fixed some language nesting issues, but introduced a regression for the case that there is a standard paragraph in a foreign language, followed by a list (e.g. itemize) in the same language, followed by the end of the document, as e.g. in lib/doc/de/Additional.lyx. The reason for this was that not all language ending commands did reset state->open_polyglossia_lang_ correctly. I am sure that one can still construct broken corner cases, and I am also sure that this was already possible before b1c68dccf8f and 46aed6d2b90. However, this fix seems to fix the most important issues, and to get nesting completely correct we would probably need some stack-like structure, for languages and encodings, also for the CJK part (which is not touched at all by this commit). --- src/output_latex.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 94c261d044..cca533bab4 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -703,6 +703,8 @@ void TeXOnePar(Buffer const & buf, "$$lang", prev_lang)) << lang_command_termination; + if (prev_lang == state->open_polyglossia_lang_) + state->open_polyglossia_lang_ = ""; } // We need to open a new language if we couldn't close the previous @@ -1249,6 +1251,8 @@ void latexParagraphs(Buffer const & buf, "$$lang", mainlang)) << '\n'; + if (state->open_polyglossia_lang_ == mainlang) + state->open_polyglossia_lang_ = ""; } // If the last paragraph is an environment, we'll have to close -- 2.39.2