]> git.lyx.org Git - features.git/commitdiff
Fix bug 2978 (inset-dissolve does not reset latex language)
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 12 Nov 2006 16:11:51 +0000 (16:11 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 12 Nov 2006 16:11:51 +0000 (16:11 +0000)
* src/text.C
(LyXText::dissolveInset): Reset language to buffer language if the
dissolved inset is an ERT inset.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15888 a592a061-630c-0410-9148-cb99ea01b6c8

src/text.C

index 674b7103f16c146a25b47e9055825379d873104b..e1b7320c643821e725f8642e2d3686ab347e1f55 100644 (file)
@@ -1793,6 +1793,7 @@ bool LyXText::dissolveInset(LCursor & cur) {
        if (isMainText(*cur.bv().buffer()) || cur.inset().nargs() != 1)
                return false;
 
+       bool const in_ert = cur.inset().lyxCode() == InsetBase::ERT_CODE;
        recordUndoInset(cur);
        cur.selHandle(false);
        // save position
@@ -1810,6 +1811,19 @@ bool LyXText::dissolveInset(LCursor & cur) {
        // FIXME: change tracking (MG)
        cur.paragraph().eraseChar(cur.pos(), b.params().trackChanges);
        if (!plist.empty()) {
+               if (in_ert) {
+                       // ERT paragraphs have the Language latex_language.
+                       // This is invalid outside of ERT, so we need to
+                       // change it to the buffer language.
+                       ParagraphList::iterator it = plist.begin();
+                       ParagraphList::iterator it_end = plist.end();
+                       for (; it != it_end; it++) {
+                               it->changeLanguage(b.params(),
+                                               latex_language,
+                                               b.getLanguage());
+                       }
+               }
+
                pasteParagraphList(cur, plist, b.params().textclass,
                                   b.errorList("Paste"));
                // restore position