commit a3fa3af48491cdb4d8955ac1e7280ab32b011edb
Author: Juergen Spitzmueller <[email protected]>
Date: Tue Sep 8 11:53:40 2026 +0200
Fix language setting after verbatim par if a secondary language was in
effect (#13361)
(cherry picked from commit ad1e9f18b5db7253a1d0ed8956fc02d58e455831)
---
src/output_latex.cpp | 22 +++++++++++-----------
status.25x | 3 +++
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index f16a1c6199..b938210fdf 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -952,9 +952,9 @@ void TeXOnePar(Buffer const & buf,
// environment with nesting depth greater than (or equal to, but with
// a different layout) the current one. If there is no previous
// paragraph, the previous language is the outer language.
- // Note further that we take the outer language also if the prior par
- // is PassThru, since in that case it has latex_language, and all
secondary
- // languages have been closed (#10793).
+ // Note further that if the prior par is PassThru, we check the
language of
+ // the first non-PassThru paragraph before since PassThru pars have
latex_language
+ // (#10793).
bool const use_prev_env_language = state->prev_env_language_ != nullptr
&& priorpar
&& priorpar->layout().isEnvironment()
@@ -965,27 +965,27 @@ void TeXOnePar(Buffer const & buf,
// We need to ignore previous intitle commands since languages
// are switched locally there (# 11514)
// There might be paragraphs before the title, so we check this.
- Paragraph * prior_nontitle_par = nullptr;
+ // Since we are interested in language, we also skip passThru pars
(#13361).
+ Paragraph * prior_nontitle_nonpt_par = nullptr;
if (!intitle_command) {
pit_type ppit = pit;
while (ppit > 0) {
--ppit;
Paragraph const * tmppar = ¶graphs.at(ppit);
- if (tmppar->layout().intitle &&
tmppar->layout().isCommand())
+ if ((tmppar->layout().intitle &&
tmppar->layout().isCommand())
+ || tmppar->isPassThru())
continue;
- prior_nontitle_par = const_cast<Paragraph*>(tmppar);
+ prior_nontitle_nonpt_par =
const_cast<Paragraph*>(tmppar);
break;
}
}
- bool const have_prior_nptpar =
- prior_nontitle_par && !prior_nontitle_par->isPassThru();
Language const * const prev_language =
runparams_in.find_effective()
? languages.getLanguage("ignore")
- : (have_prior_nptpar)
+ : (prior_nontitle_nonpt_par)
? (use_prev_env_language
? state->prev_env_language_
- :
prior_nontitle_par->getParLanguage(bparams))
+ :
prior_nontitle_nonpt_par->getParLanguage(bparams))
: outer_language;
bool const use_polyglossia = runparams.use_polyglossia;
@@ -1040,7 +1040,7 @@ void TeXOnePar(Buffer const & buf,
&& runparams.local_font != nullptr
&& outer_language->rightToLeft()
&& !par_language->rightToLeft()
- && !(have_prior_nptpar
+ && !(prior_nontitle_nonpt_par
&& (prev_language->rightToLeft() !=
par_language->rightToLeft()));
bool const localswitch =
(runparams_in.find_effective()
diff --git a/status.25x b/status.25x
index 5af9a952ae..d9b9fb3ac4 100644
--- a/status.25x
+++ b/status.25x
@@ -43,6 +43,9 @@ What's new
- Fix language setting after switching from PassThru paragraph (bug 13233).
+- Fix language setting after verbatim paragraph if a secondary language was
+ in effect (bug 13361).
+
* USER INTERFACE
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs