]> git.lyx.org Git - features.git/commitdiff
Fix bug #8027: Edit->Paste Special->... does not replace selected text
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 29 Jun 2012 13:18:20 +0000 (15:18 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 29 Jun 2012 13:18:20 +0000 (15:18 +0200)
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
status.20x

index 5865afd22bdbff4f0b58346d4753bdec2d4c24bd..dc30d5adedb5128a97980d2ede418e11aae58cfd 100644 (file)
@@ -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)
index cfd8da54e6947a51576b0bcc688c2b0ceeb95c28..def9da30550c9c57e42f3ade1ba841a38e4bdc5c 100644 (file)
@@ -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