]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
Revert unintentional commits.
[lyx.git] / src / CutAndPaste.cpp
index a9b8fc9b30acd6616cd021944d71e7c22e397020..ee639f3c6c27ad95feb43329e7515a68546e3a06 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "Buffer.h"
 #include "buffer_funcs.h"
+#include "BufferList.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Changes.h"
@@ -365,17 +366,18 @@ void putClipboard(ParagraphList const & paragraphs,
        // a DocumentClass, via new, that is never deleted. If we were to go to
        // some kind of garbage collection there, or a shared_ptr, then this
        // would not be needed.
-       static Buffer buffer("", false);
-       buffer.setUnnamed(true);
-       buffer.paragraphs() = paragraphs;
-       buffer.params().setDocumentClass(docclass);
+       static Buffer * buffer = theBufferList().newBuffer(
+               FileName::tempName().absFilename());
+       buffer->setUnnamed(true);
+       buffer->paragraphs() = paragraphs;
+       buffer->params().setDocumentClass(docclass);
        ostringstream lyx;
-       if (buffer.write(lyx))
+       if (buffer->write(lyx))
                theClipboard().put(lyx.str(), plaintext);
        else
                theClipboard().put(string(), plaintext);
        // Save that memory
-       buffer.paragraphs().clear();
+       buffer->paragraphs().clear();
 }
 
 
@@ -755,7 +757,7 @@ void saveSelection(Cursor & cur)
        if (cur.selection() 
            && cur.selBegin() == cur.bv().cursor().selBegin()
            && cur.selEnd() == cur.bv().cursor().selEnd()) {
-               LYXERR(Debug::ACTION, "'" << cur.selectionAsString(true) << "'");
+               LYXERR(Debug::SELECTION, "saveSelection: '" << cur.selectionAsString(true) << "'");
                copySelectionToStack(cur, selectionBuffer);
        }
 }