]> git.lyx.org Git - features.git/commitdiff
Handle plain text/html rows/columns in tabular LFUN_PASTE
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 22 Apr 2019 08:56:00 +0000 (10:56 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 22 Apr 2019 08:56:00 +0000 (10:56 +0200)
Fixes: #7932
src/insets/InsetTabular.cpp

index 9f2ef5efa9e4487d32a8da8beafc3738a78ae687..a0bfec8882a1efa081e7f90f5208b9521acfe8ed 100644 (file)
@@ -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;