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

see r32750.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@32807 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-01-06 20:56:15 +00:00
parent 7554c40dbb
commit 39d43fcd78
2 changed files with 27 additions and 11 deletions

View File

@ -243,16 +243,31 @@ static bool doInsertInset(Cursor & cur, Text * text,
cur.clearSelection(); // bug 393 cur.clearSelection(); // bug 393
cur.finishUndo(); cur.finishUndo();
InsetText * insetText = dynamic_cast<InsetText *>(inset); InsetText * insetText = dynamic_cast<InsetText *>(inset);
if (insetText && (!insetText->allowMultiPar() || cur.lastpit() == 0)) { if (insetText) {
// reset first par to default if (insetText->getLayout(bparams).isPassThru()) {
cur.text()->paragraphs().begin() // Fix the font of all paragraphs
->setPlainOrDefaultLayout(bparams.documentClass()); Font font(inherit_font, bparams.language);
cur.pos() = 0; font.setLanguage(latex_language);
cur.pit() = 0; ParagraphList::iterator par = insetText->paragraphs().begin();
// Merge multiple paragraphs -- hack ParagraphList::iterator const end = insetText->paragraphs().end();
while (cur.lastpit() > 0) while (par != end) {
mergeParagraph(bparams, cur.text()->paragraphs(), 0); par->resetFonts(font);
cur.leaveInset(*inset); par->params().clear();
++par;
}
}
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 { } else {
cur.leaveInset(*inset); cur.leaveInset(*inset);
// reset surrounding par to default // reset surrounding par to default
@ -262,7 +277,6 @@ static bool doInsertInset(Cursor & cur, Text * text,
: dc.defaultLayoutName(); : dc.defaultLayoutName();
text->setLayout(cur, layoutname); text->setLayout(cur, layoutname);
} }
return true; return true;
} }

View File

@ -77,6 +77,8 @@ What's new
- Allow using single quotes in filenames (bug 4063). - Allow using single quotes in filenames (bug 4063).
- Do not insert \foreignlanguage in ERTs (bug 6426).
* USER INTERFACE * USER INTERFACE