]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
Update status
[lyx.git] / src / CutAndPaste.cpp
index 43e6278b3ef65e60a694ee507b9418f06d09952f..cad8c943deeb8cf5550092e49c20198bd133eeb7 100644 (file)
@@ -142,6 +142,14 @@ pasteSelectionHelper(DocIterator const & cur, ParagraphList const & parlist,
        // Now remove all out of the pars which is NOT allowed in the
        // new environment and set also another font if that is required.
 
+       // Merge paragraphs that are to be pasted into a text inset
+       // that does not allow multiple pars.
+       InsetText * inset_text = target_inset->asInsetText();
+       if (inset_text && !inset_text->allowMultiPar()) {
+               while (insertion.size() > 1)
+                       mergeParagraph(buffer.params(), insertion, 0);
+       }
+
        // Convert newline to paragraph break in ParbreakIsNewline
        if (target_inset->getLayout().parbreakIsNewline()
            || pars[pit].layout().parbreak_is_newline) {
@@ -1082,7 +1090,12 @@ void copySelection(Cursor const & cur, docstring const & plaintext)
                Paragraph par;
                BufferParams const & bp = cur.buffer()->params();
                par.setLayout(bp.documentClass().plainLayout());
-               par.insert(0, plaintext, Font(), Change(Change::UNCHANGED));
+               // Replace (column-separating) tabs by space (#4449)
+               docstring const clean_text = subst(plaintext, '\t', ' ');
+               // For pasting into text, we set the language to the paragraph language
+               // (rather than the default_language which is always English; see #11898)
+               par.insert(0, clean_text, Font(sane_font, par.getParLanguage(bp)),
+                          Change(Change::UNCHANGED));
                pars.push_back(par);
                theCuts.push(make_pair(pars, bp.documentClassPtr()));
        } else {