mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Fix language closing before inset
This commit is contained in:
parent
24af4ffcb3
commit
92f6e4806e
@ -1078,6 +1078,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
|
|||||||
rp, running_font,
|
rp, running_font,
|
||||||
basefont, true,
|
basefont, true,
|
||||||
cprotect);
|
cprotect);
|
||||||
|
open_font = true;
|
||||||
column += count2;
|
column += count2;
|
||||||
if (count2 == 0 && (lang_closed || lang_switched_at_inset))
|
if (count2 == 0 && (lang_closed || lang_switched_at_inset))
|
||||||
// All fonts closed
|
// All fonts closed
|
||||||
@ -2572,7 +2573,7 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
++column;
|
++column;
|
||||||
|
|
||||||
// Fully instantiated font
|
// Fully instantiated font
|
||||||
Font const current_font = getFont(bparams, i, outerfont);
|
Font current_font = getFont(bparams, i, outerfont);
|
||||||
// Previous font
|
// Previous font
|
||||||
Font const prev_font = (i > 0) ?
|
Font const prev_font = (i > 0) ?
|
||||||
getFont(bparams, i - 1, outerfont)
|
getFont(bparams, i - 1, outerfont)
|
||||||
@ -2612,8 +2613,7 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
((current_font != running_font
|
((current_font != running_font
|
||||||
|| current_font.language() != running_font.language())
|
|| current_font.language() != running_font.language())
|
||||||
|| (fontswitch_inset
|
|| (fontswitch_inset
|
||||||
&& (current_font == prev_font
|
&& (current_font == prev_font))))
|
||||||
|| current_font.language() == prev_font.language()))))
|
|
||||||
{
|
{
|
||||||
// ensure there is no open script-wrapper
|
// ensure there is no open script-wrapper
|
||||||
if (!alien_script.empty()) {
|
if (!alien_script.empty()) {
|
||||||
@ -2628,6 +2628,9 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
os << '}';
|
os << '}';
|
||||||
column += 1;
|
column += 1;
|
||||||
}
|
}
|
||||||
|
if (closeLanguage)
|
||||||
|
// Force language closing
|
||||||
|
current_font.setLanguage(basefont.language());
|
||||||
column += running_font.latexWriteEndChanges(
|
column += running_font.latexWriteEndChanges(
|
||||||
os, bparams, runparams, basefont,
|
os, bparams, runparams, basefont,
|
||||||
(i == body_pos-1) ? basefont : current_font,
|
(i == body_pos-1) ? basefont : current_font,
|
||||||
@ -2683,7 +2686,8 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do we need to change font?
|
// Do we need to change font?
|
||||||
if ((current_font != running_font ||
|
if (!fontswitch_inset &&
|
||||||
|
(current_font != running_font ||
|
||||||
current_font.language() != running_font.language())
|
current_font.language() != running_font.language())
|
||||||
&& i != body_pos - 1)
|
&& i != body_pos - 1)
|
||||||
{
|
{
|
||||||
@ -2699,7 +2703,6 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
column += 1;
|
column += 1;
|
||||||
}
|
}
|
||||||
otexstringstream ots;
|
otexstringstream ots;
|
||||||
if (!fontswitch_inset) {
|
|
||||||
InsetText const * textinset = inInset().asInsetText();
|
InsetText const * textinset = inInset().asInsetText();
|
||||||
bool const cprotect = textinset
|
bool const cprotect = textinset
|
||||||
? textinset->hasCProtectContent(runparams.moving_arg)
|
? textinset->hasCProtectContent(runparams.moving_arg)
|
||||||
@ -2708,7 +2711,6 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
column += current_font.latexWriteStartChanges(ots, bparams,
|
column += current_font.latexWriteStartChanges(ots, bparams,
|
||||||
runparams, basefont, last_font, false,
|
runparams, basefont, last_font, false,
|
||||||
cprotect);
|
cprotect);
|
||||||
}
|
|
||||||
// Check again for display math in ulem commands as a
|
// Check again for display math in ulem commands as a
|
||||||
// font change may also occur just before a math inset.
|
// font change may also occur just before a math inset.
|
||||||
if (runparams.inDisplayMath && !deleted_display_math
|
if (runparams.inDisplayMath && !deleted_display_math
|
||||||
|
Loading…
Reference in New Issue
Block a user