]> git.lyx.org Git - features.git/commitdiff
Merge paragraphs when pasted into an inset that forbids multipars
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 11 May 2018 11:17:39 +0000 (13:17 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 11 May 2018 11:17:39 +0000 (13:17 +0200)
Fixes: #8281
src/CutAndPaste.cpp

index 9088f6b6ccb8059589f09e6e9a14856d84c44852..329d3f9248bbda68e6cc6d0ed4c1199c45caecee 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) {