]> git.lyx.org Git - features.git/commitdiff
Introduce new function copyInsetToTemp
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 4 Nov 2022 20:44:24 +0000 (21:44 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 4 Nov 2022 20:44:24 +0000 (21:44 +0100)
This is a version of copyInset that does touch the cut stack and the X
selection.

Part of bug #4582.

src/CutAndPaste.cpp
src/CutAndPaste.h

index 0446175e6988291845b051e8412fef3b233fa787..5a6130d5c6304e11e588aff338044fa16624c2c6 100644 (file)
@@ -1037,7 +1037,9 @@ void copySelection(Cursor const & cur)
 }
 
 
-void copyInset(Cursor const & cur, Inset * inset, docstring const & plaintext)
+namespace {
+
+void copyInsetToStack(Cursor const & cur, CutStack & cutstack, Inset * inset)
 {
        ParagraphList pars;
        Paragraph par;
@@ -1046,13 +1048,28 @@ void copyInset(Cursor const & cur, Inset * inset, docstring const & plaintext)
        Font font(inherit_font, bp.language);
        par.insertInset(0, inset, font, Change(Change::UNCHANGED));
        pars.push_back(par);
-       theCuts.push(make_pair(pars, make_pair(bp.documentClassPtr(), bp.authors())));
+       cutstack.push(make_pair(pars, make_pair(bp.documentClassPtr(), bp.authors())));
+}
+
+}
+
+
+void copyInset(Cursor const & cur, Inset * inset, docstring const & plaintext)
+{
+       copyInsetToStack(cur, theCuts, inset);
 
        // stuff the selection onto the X clipboard, from an explicit copy request
+       BufferParams const & bp = cur.buffer()->params();
        putClipboard(theCuts[0].first, theCuts[0].second, plaintext, bp);
 }
 
 
+void copyInsetToTemp(Cursor const & cur, Inset * inset)
+{
+       copyInsetToStack(cur, tempCut, inset);
+}
+
+
 namespace {
 
 void copySelectionToStack(CursorData const & cur, CutStack & cutstack)
index 664033209c890f452c0f17923e13ea1fc4db8b87..d7fec67c176a930b5133531eac25721b75f4134f 100644 (file)
@@ -79,6 +79,8 @@ void copySelection(Cursor const & cur);
 void copySelectionToTemp(Cursor const & cur);
 ///
 void copyInset(Cursor const & cur, Inset * inset, docstring const & plaintext);
+///
+void copyInsetToTemp(Cursor const & cur, Inset * inset);
 /**
  * Push the current selection to the cut buffer and the system clipboard.
  * \param plaintext plain text version of the selection for the system