]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
Add some comments.
[lyx.git] / src / CutAndPaste.cpp
index 64718ae12638fbe63b1eafd658694eb81e36c344..f13664b35df76db5ec2e41aa51f12e5e3c289beb 100644 (file)
@@ -154,8 +154,9 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
                }
        }
 
+       InsetText in(buffer);
        // Make sure there is no class difference.
-       InsetText in;
+       in.paragraphs().clear();
        // This works without copying any paragraph data because we have
        // a specialized swap method for ParagraphList. This is important
        // since we store pointers to insets at some places and we don't
@@ -285,6 +286,9 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
                // merge the first par of the insertion with the current par
                mergeParagraph(buffer.params(), pars, pit);
        }
+       //FIXME: We should call setBuffer() on each inserted paragraph.
+       // instead, we call setBuffer() for the main inset at the beginning
+       // of updateLabels()
 
        pit_type last_paste = pit + insertion.size() - 1;
 
@@ -371,6 +375,7 @@ void putClipboard(ParagraphList const & paragraphs,
                FileName::tempName().absFilename() + "_clipboard.internal");
        buffer->setUnnamed(true);
        buffer->paragraphs() = paragraphs;
+       buffer->inset().setBuffer(*buffer);
        buffer->params().setDocumentClass(docclass);
        ostringstream lyx;
        if (buffer->write(lyx))