From: Jean-Marc Lasgouttes Date: Fri, 29 Jun 2012 13:18:20 +0000 (+0200) Subject: Fix bug #8027: Edit->Paste Special->... does not replace selected text X-Git-Tag: 2.0.5~136 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=111f15f335f1c7fad2537e4df923b1d61978f75e;p=features.git Fix bug #8027: Edit->Paste Special->... does not replace selected text Delete the selection before all paste-like lfuns. This was previoulsy done only for LFUN_PASTE, the others at best unset the selection. --- diff --git a/src/Text3.cpp b/src/Text3.cpp index 5865afd22b..dc30d5aded 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1314,13 +1314,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } case LFUN_CLIPBOARD_PASTE: - cur.clearSelection(); + cap::replaceSelection(cur); pasteClipboardText(cur, bv->buffer().errorList("Paste"), cmd.argument() == "paragraph"); bv->buffer().errors("Paste"); break; case LFUN_PRIMARY_SELECTION_PASTE: + cap::replaceSelection(cur); pasteString(cur, theSelection().get(), cmd.argument() == "paragraph"); break; @@ -1329,6 +1330,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) // Copy the selection buffer to the clipboard stack, // because we want it to appear in the "Edit->Paste // recent" menu. + cap::replaceSelection(cur); cap::copySelectionToStack(); cap::pasteSelection(bv->cursor(), bv->buffer().errorList("Paste")); bv->buffer().errors("Paste"); @@ -2809,7 +2811,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, void Text::pasteString(Cursor & cur, docstring const & clip, bool asParagraphs) { - cur.clearSelection(); if (!clip.empty()) { cur.recordUndo(); if (asParagraphs) diff --git a/status.20x b/status.20x index cfd8da54e6..def9da3055 100644 --- a/status.20x +++ b/status.20x @@ -60,7 +60,10 @@ What's new * USER INTERFACE -- Fix various crashes when single document is edited in more windows (bug 8203). +- Fix various crashes when single document is edited in more windows + (bug 8203). + +- Replace current selection when pasting (bug 8027). * DOCUMENTATION AND LOCALIZATION