]> git.lyx.org Git - features.git/commitdiff
Fix language nesting regression
authorGeorg Baum <baum@lyx.org>
Mon, 19 Oct 2015 19:08:01 +0000 (21:08 +0200)
committerGeorg Baum <baum@lyx.org>
Mon, 19 Oct 2015 19:08:01 +0000 (21:08 +0200)
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

index 94c261d044666e628ef2f4eef5f385f802dcd447..cca533bab4586123daf2a15b18f00cda32c9c89f 100644 (file)
@@ -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