mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 07:42:02 +00:00
Fix bug #5096: Language switch fails in environments.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30628 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1fda2e4577
commit
399324baec
@ -345,11 +345,33 @@ TeXOnePar(Buffer const & buf,
|
|||||||
// The previous language that was in effect is either the language of
|
// The previous language that was in effect is either the language of
|
||||||
// the previous paragraph, if there is one, or else the outer language
|
// the previous paragraph, if there is one, or else the outer language
|
||||||
// if there is no previous paragraph
|
// if there is no previous paragraph
|
||||||
Language const * const prev_language =
|
Language const * prev_language =
|
||||||
(pit != paragraphs.begin()) ?
|
(pit != paragraphs.begin()) ?
|
||||||
priorpit->getParLanguage(bparams) : outer_language;
|
priorpit->getParLanguage(bparams) : outer_language;
|
||||||
|
|
||||||
if (par_language->babel() != prev_language->babel()
|
// When the language is changed at the very start of a LyX environment,
|
||||||
|
// the language switch in the LaTeX code occurs just before switching to
|
||||||
|
// the corresponding LaTeX environment. So, when the environment ends,
|
||||||
|
// we have to restore the language that was in effect.
|
||||||
|
bool env_lang_switch = false;
|
||||||
|
if (!priorpit->hasSameLayout(*pit)) {
|
||||||
|
ParagraphList::const_iterator outpit = priorpit;
|
||||||
|
while (outpit != paragraphs.begin()
|
||||||
|
&& (outpit->hasSameLayout(*priorpit)
|
||||||
|
|| outpit->getDepth() > priorpit->getDepth()))
|
||||||
|
outpit = boost::prior(outpit);
|
||||||
|
ParagraphList::const_iterator const inpit = boost::next(outpit);
|
||||||
|
Language const * const outenv_language
|
||||||
|
= outpit->getParLanguage(bparams);
|
||||||
|
Language const * const inenv_language
|
||||||
|
= inpit->getParLanguage(bparams);
|
||||||
|
if (outenv_language->babel() != inenv_language->babel())
|
||||||
|
env_lang_switch = true;
|
||||||
|
if (outenv_language->babel() != par_language->babel())
|
||||||
|
prev_language = outenv_language;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((par_language->babel() != prev_language->babel() || env_lang_switch)
|
||||||
// check if we already put language command in TeXEnvironment()
|
// check if we already put language command in TeXEnvironment()
|
||||||
&& !(style.isEnvironment()
|
&& !(style.isEnvironment()
|
||||||
&& (pit == paragraphs.begin() ||
|
&& (pit == paragraphs.begin() ||
|
||||||
|
@ -130,6 +130,8 @@ What's new
|
|||||||
does not have one. This assures the caption is not repeated after a
|
does not have one. This assures the caption is not repeated after a
|
||||||
page break and consequently in the list of tables (bug 6057).
|
page break and consequently in the list of tables (bug 6057).
|
||||||
|
|
||||||
|
- Fix language settings after an environment (bug 5096).
|
||||||
|
|
||||||
|
|
||||||
* USER INTERFACE
|
* USER INTERFACE
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user