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.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) {
if (insetText->getLayout(bparams).isPassThru()) {
// Fix the font of all paragraphs
Font font(inherit_font, bparams.language);
font.setLanguage(latex_language);
ParagraphList::iterator par = insetText->paragraphs().begin();
ParagraphList::iterator const end = insetText->paragraphs().end();
while (par != end) {
par->resetFonts(font);
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 {
cur.leaveInset(*inset);
// reset surrounding par to default
@ -262,7 +277,6 @@ static bool doInsertInset(Cursor & cur, Text * text,
: dc.defaultLayoutName();
text->setLayout(cur, layoutname);
}
return true;
}

View File

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