[LyX/master] Let "copy plain" copy no screen labels (as opposed to default copy) (#7558)

Juergen Spitzmueller <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit fc8a4f4bcc53704dd3de807d8e999810ef9fad53
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun Aug 16 14:57:08 2026 +0200

    Let "copy plain" copy no screen labels (as opposed to default copy) (#7558)
---
 lib/ui/stdmenus.inc | 1 +
 src/BufferView.cpp  | 3 ++-
 src/CutAndPaste.cpp | 4 ++--
 src/CutAndPaste.h   | 3 ++-
 src/LyXAction.cpp   | 2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/ui/stdmenus.inc b/lib/ui/stdmenus.inc
index 5c9c9106f0..979e274bd5 100644
--- a/lib/ui/stdmenus.inc
+++ b/lib/ui/stdmenus.inc
@@ -163,6 +163,7 @@ Menuset
 		Item "Copy as LaTeX|L" "copy latex"
 		Item "Copy as XHTML|H" "copy xhtml"
 		Item "Copy as DocBook|D" "copy docbook"
+		Item "Copy as Plain Text (without Labels)|T" "copy plain"
 	End
 
 	Menu "edit_paste"
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 30fd367a53..b7c8ad52c4 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2693,7 +2693,8 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 			option = AS_STR_XHTML;
 		else if (type == "docbook")
 			option = AS_STR_DOCBOOK;
-		cap::copySelection(cur, option);
+		bool const with_label = type != "plain";
+		cap::copySelection(cur, option, with_label);
 		if (!type.empty())
 			cur.message(bformat(_("Copy to Format: %1$s"), from_ascii(type)));
 		else
diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index 8f6d9d7555..7b7df91c86 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -1045,9 +1045,9 @@ void cutSelectionToTemp(Cursor & cur, bool realcut)
 }
 
 
-void copySelection(Cursor const & cur, int const option)
+void copySelection(Cursor const & cur, int const option, bool const with_label)
 {
-	copySelection(cur, cur.selectionAsString(true, true, option));
+	copySelection(cur, cur.selectionAsString(with_label, true, option));
 }
 
 
diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index db4edc08f6..68eac50198 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -71,7 +71,8 @@ void cutSelection(Cursor & cur, bool realcut = true);
 void cutSelectionToTemp(Cursor & cur, bool realcut = true);
 
 /// Push the current selection to the cut buffer and the system clipboard.
-void copySelection(Cursor const & cur, int const option = 0);
+void copySelection(Cursor const & cur, int const option = 0,
+		   bool const with_label = true);
 /// Like copySelection, but only put to temporary cut buffer
 void copySelectionToTemp(Cursor const & cur);
 ///
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 5cd182d627..f5939d8f07 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -1436,7 +1436,7 @@ void LyXAction::init()
  * \var lyx::FuncCode lyx::LFUN_COPY
  * \li Action: Copies the current selection to the clipboard.
  * \li Syntax: copy [<type>]
- * \li Params: <type>: type of copy, possible values: plain (= default), latex,
+ * \li Params: <type>: type of copy, possible values: plain (= without labels), latex,
  *             html, docbook
  * \endvar
  */
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.