Don't add localswitch if no language changes

This commit is contained in:
Juergen Spitzmueller 2018-04-27 18:27:21 +02:00
parent cf7c31b559
commit 7018d3641f

View File

@ -839,8 +839,10 @@ void TeXOnePar(Buffer const & buf,
lang_command_termination.clear(); lang_command_termination.clear();
} }
bool const localswitch_needed = localswitch && par_lang != outer_lang;
// localswitches need to be closed and reopened at each par // localswitches need to be closed and reopened at each par
if ((par_lang != prev_lang || localswitch) if ((par_lang != prev_lang || localswitch_needed)
// check if we already put language command in TeXEnvironment() // check if we already put language command in TeXEnvironment()
&& !(style.isEnvironment() && !(style.isEnvironment()
&& (pit == 0 || (priorpar->layout() != par.layout() && (pit == 0 || (priorpar->layout() != par.layout()
@ -1115,7 +1117,7 @@ void TeXOnePar(Buffer const & buf,
&&((nextpar && par_lang != nextpar_lang) &&((nextpar && par_lang != nextpar_lang)
|| (runparams.isLastPar && par_lang != outer_lang)); || (runparams.isLastPar && par_lang != outer_lang));
if (localswitch if (localswitch_needed
|| (intitle_command && using_begin_end) || (intitle_command && using_begin_end)
|| closing_rtl_ltr_environment || closing_rtl_ltr_environment
|| ((runparams.isLastPar || close_lang_switch) || ((runparams.isLastPar || close_lang_switch)