[LyX/master] Fix copy of multi-cells in table (#12196)

Juergen Spitzmueller spitz at lyx.org
Fri Mar 12 16:39:41 UTC 2021


commit ae892bff98962359e3a29d0d3bc7e69bdc3ea72b
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Mar 12 17:41:43 2021 +0100

    Fix copy of multi-cells in table (#12196)
---
 src/BufferView.cpp          |    7 +++++++
 src/insets/InsetTabular.cpp |    7 +++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 4289e31..79bf01f 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2264,6 +2264,13 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 	}
 
 	case LFUN_COPY:
+		// With multi-cell table content, we pass down to the inset
+		if (cur.inTexted() && cur.selection()
+		    && cur.selectionBegin().idx() != cur.selectionEnd().idx()) {
+			buffer_.dispatch(cmd, dr);
+			dispatched = dr.dispatched();
+			break;
+		}
 		cap::copySelection(cur);
 		cur.message(_("Copy"));
 		break;
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index ec2a7a3..cea677b 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -5262,6 +5262,13 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 		}
 		break;
 
+	case LFUN_COPY:
+		if (cur.selIsMultiCell())
+			copySelection(cur);
+		else
+			cell(cur.idx())->dispatch(cur, cmd);
+		break;
+
 	case LFUN_CUT:
 		if (cur.selIsMultiCell()) {
 			if (copySelection(cur)) {


More information about the lyx-cvs mailing list