Fix bug #6426: Language not set correctly when inserting an Inset.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32750 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-01-03 01:13:55 +00:00
parent f78308afde
commit 2a257eca85

View File

@ -267,16 +267,19 @@ static bool doInsertInset(Cursor & cur, Text * text,
cur.clearSelection(); // bug 393
cur.finishUndo();
InsetText * insetText = dynamic_cast<InsetText *>(inset);
if (insetText && (!insetText->allowMultiPar() || cur.lastpit() == 0)) {
// reset first par to default
cur.text()->paragraphs().begin()
->setPlainOrDefaultLayout(bparams.documentClass());
cur.pos() = 0;
cur.pit() = 0;
// Merge multiple paragraphs -- hack
while (cur.lastpit() > 0)
mergeParagraph(bparams, cur.text()->paragraphs(), 0);
cur.leaveInset(*inset);
if (insetText) {
insetText->fixParagraphsFont();
if (!insetText->allowMultiPar() || cur.lastpit() == 0) {
// reset first par to default
cur.text()->paragraphs().begin()
->setPlainOrDefaultLayout(bparams.documentClass());
cur.pos() = 0;
cur.pit() = 0;
// Merge multiple paragraphs -- hack
while (cur.lastpit() > 0)
mergeParagraph(bparams, cur.text()->paragraphs(), 0);
cur.leaveInset(*inset);
}
} else {
cur.leaveInset(*inset);
// reset surrounding par to default
@ -286,7 +289,6 @@ static bool doInsertInset(Cursor & cur, Text * text,
: dc.defaultLayoutName();
text->setLayout(cur, layoutname);
}
return true;
}