From 2856ff9452be25bf994d29ba29a2a0e507f806c0 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 22 Apr 2019 10:56:00 +0200 Subject: [PATCH] Handle plain text/html rows/columns in tabular LFUN_PASTE Fixes: #7932 --- src/insets/InsetTabular.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 9f2ef5efa9..a0bfec8882 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -4982,6 +4982,19 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_PASTE: if (!tabularStackDirty()) { + // Check if we have plain text or HTML with rows/columns. + // and if so, pass over to LFUN_CLIPBOARD_PASTE + if (!theClipboard().hasGraphicsContents() + && theClipboard().hasTextContents(Clipboard::AnyTextType) + && !theClipboard().hasTextContents(Clipboard::LyXTextType)) { + 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; -- 2.39.5