[LyX/master] Fix c&p of tabular data between different LyX instances (#4448)

Juergen Spitzmueller spitz at lyx.org
Mon Jun 29 16:28:51 UTC 2020


commit 3718ff9a1501fbdb19799947b3cfaf5c6568eaff
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Jun 29 18:52:10 2020 +0200

    Fix c&p of tabular data between different LyX instances (#4448)
---
 src/insets/InsetTabular.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 2bfa391..e007e59 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -5184,6 +5184,16 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
 					break;
 				}
 			}
+			else if (theClipboard().hasTextContents(Clipboard::LyXTextType)) {
+				// This might be tabular data from another LyX instance. Check!
+				docstring const clip =
+					theClipboard().getAsText(Clipboard::PlainTextType);
+				if (clip.find_first_of(from_ascii("\t\n")) != docstring::npos) {
+					FuncRequest ncmd = FuncRequest(LFUN_CLIPBOARD_PASTE, cmd.argument());
+					doDispatch(cur, ncmd);
+					break;
+				}
+			}
 			if (!cur.selIsMultiCell())
 				cell(cur.idx())->dispatch(cur, cmd);
 			break;


More information about the lyx-cvs mailing list