commit 0b27eb7deba6fd255fa284b1c691bb5a2998fc6d
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Fri Nov 4 21:44:24 2022 +0100

    Introduce new function copyInsetToTemp
    
    This is a version of copyInset that does touch the cut stack and the X
    selection.
    
    Part of bug #4582.
---
 src/CutAndPaste.cpp |   21 +++++++++++++++++++--
 src/CutAndPaste.h   |    2 ++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index 0446175..5a6130d 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -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)
diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index 6640332..d7fec67 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -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
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to