X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsettabular.C;h=202ac6fa44bb8495781e2a56dd4919f2a87029ff;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=16c105524d8204cdd79a5e27729402270a65f5aa;hpb=fed31122c415f4b310e254e5db7197f786960b01;p=lyx.git diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 16c105524d..202ac6fa44 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -501,7 +501,17 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd) } if (cmd.button() == mouse_button::button2) { - cmd = FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"); + if (bvcur.selection()) { + // See comment in LyXText::dispatch why we + // do this + // FIXME This does not use paste_tabular, + // another reason why paste_tabular should go. + cap::copySelectionToStack(bvcur); + cmd = FuncRequest(LFUN_PASTE, "0"); + } else { + cmd = FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, + "paragraph"); + } doDispatch(cur, cmd); } break; @@ -669,12 +679,12 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd) break; // insert file functions - case LFUN_FILE_INSERT_ASCII_PARA: - case LFUN_FILE_INSERT_ASCII: { + case LFUN_FILE_INSERT_PLAINTEXT_PARA: + case LFUN_FILE_INSERT_PLAINTEXT: { // FIXME UNICODE - string const tmpstr = getContentsOfAsciiFile(&cur.bv(), to_utf8(cmd.argument()), false); + string const tmpstr = getContentsOfPlaintextFile(&cur.bv(), to_utf8(cmd.argument()), false); // FIXME: We don't know the encoding of the file - if (!tmpstr.empty() && !insertAsciiString(cur.bv(), from_utf8(tmpstr), false)) + if (!tmpstr.empty() && !insertPlaintextString(cur.bv(), from_utf8(tmpstr), false)) cur.undispatched(); break; } @@ -713,14 +723,14 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd) case LFUN_CLIPBOARD_PASTE: case LFUN_PRIMARY_SELECTION_PASTE: { docstring const clip = (cmd.action == LFUN_CLIPBOARD_PASTE) ? - theClipboard().get() : + theClipboard().getAsText() : theSelection().get(); if (clip.empty()) break; - // pass to InsertAsciiString, but + // pass to InsertPlaintextString, but // only if we have multi-cell content if (clip.find_first_of(from_ascii("\t\n")) != docstring::npos) { - if (insertAsciiString(cur.bv(), clip, false)) { + if (insertPlaintextString(cur.bv(), clip, false)) { // content has been replaced, // so cursor might be invalid cur.pos() = cur.lastpos(); @@ -1261,8 +1271,6 @@ void InsetTabular::resetPos(LCursor & cur) const } cur.updateFlags(Update::Force | Update::FitCursor); - - InsetTabularMailer(*this).updateDialog(&bv); } @@ -1750,8 +1758,6 @@ void InsetTabular::tabularFeatures(LCursor & cur, case LyXTabular::LAST_ACTION: break; } - - InsetTabularMailer(*this).updateDialog(&bv); } @@ -1804,10 +1810,13 @@ bool InsetTabular::copySelection(LCursor & cur) odocstringstream os; OutputParams const runparams; paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t'); - theClipboard().put(os.str()); + // Needed for the "Edit->Paste recent" menu and the system clipboard. + cap::copySelection(cur, os.str()); + // mark tabular stack dirty // FIXME: this is a workaround for bug 1919. Should be removed for 1.5, // when we (hopefully) have a one-for-all paste mechanism. + // This must be called after cap::copySelection. dirtyTabularStack(true); return true; @@ -1944,7 +1953,7 @@ bool InsetTabular::forceDefaultParagraphs(idx_type cell) const } -bool InsetTabular::insertAsciiString(BufferView & bv, docstring const & buf, +bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf, bool usePaste) { if (buf.length() <= 0)