[LyX/2.5.x] Fix another language nesting issue
Juergen Spitzmueller <[email protected]>
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 2ddba249ecbf02566ae36a885620cac05415ebac Author: Juergen Spitzmueller <[email protected]> Date: Sun Mar 22 12:57:39 2026 +0100 Fix another language nesting issue (cherry picked from commit 662977e6b2780d0a90000e8e6b377c0530e848ae) --- src/output_latex.cpp | 14 +++++++++++--- status.25x | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index ac37d7585d..f16a1c6199 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -991,8 +991,10 @@ void TeXOnePar(Buffer const & buf, bool const use_polyglossia = runparams.use_polyglossia; string const par_lang = use_polyglossia ? getPolyglossiaEnvName(par_language): par_language->babel(); - string const prev_lang = use_polyglossia ? + string prev_lang = use_polyglossia ? getPolyglossiaEnvName(prev_language) : prev_language->babel(); + string const doc_lang = use_polyglossia ? + getPolyglossiaEnvName(doc_language) : doc_language->babel(); string const outer_lang = use_polyglossia ? getPolyglossiaEnvName(outer_language) : outer_language->babel(); string const nextpar_lang = nextpar_language ? (use_polyglossia ? @@ -1004,8 +1006,14 @@ void TeXOnePar(Buffer const & buf, "\\end{$$lang}" : lyxrc.language_command_end; // the '%' is necessary to prevent unwanted whitespace string lang_command_termination = "%\n"; - bool const using_begin_end = use_polyglossia || - !lang_end_command.empty(); + bool const using_begin_end = use_polyglossia || !lang_end_command.empty(); + + // With begin/end command, it is possible that we have closed + // the previous language already. + // In this case we need to reopen it (if it is not the main lang). + if (using_begin_end && prev_lang != doc_lang + && openLanguageName(state) != prev_lang) + prev_lang = string(); // For InTitle commands, we need to switch the language inside the command // (see #10849); thus open the command here. diff --git a/status.25x b/status.25x index 41291a8332..86797d89ab 100644 --- a/status.25x +++ b/status.25x @@ -44,7 +44,7 @@ What's new * DOCUMENT INPUT/OUTPUT - +- Fix problem with nesting of languages. * USER INTERFACE -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs