From c7549c1b546794526f6e944905db360743760c1c Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 7 Jun 2012 18:14:17 +0200 Subject: [PATCH] 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. --- src/Text3.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index 9bb3f256d4..e17e965170 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1331,18 +1331,19 @@ 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_CLIPBOARD_PASTE_SIMPLE: - cur.clearSelection(); + cap::replaceSelection(cur); pasteSimpleText(cur, cmd.argument() == "paragraph"); break; case LFUN_PRIMARY_SELECTION_PASTE: + cap::replaceSelection(cur); pasteString(cur, theSelection().get(), cmd.argument() == "paragraph"); break; @@ -1351,6 +1352,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"); @@ -2836,7 +2838,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) -- 2.39.2