]> git.lyx.org Git - features.git/commitdiff
* CutAndPaste.cpp (pasteSelection): do not set the selection after
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 31 Jul 2007 13:34:09 +0000 (13:34 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 31 Jul 2007 13:34:09 +0000 (13:34 +0000)
pasting.

* Text3.cpp (doDispatch/LFUN_MOUSE_PRESS): reorganize the code to make
sure that mouseSetCursor gets called (and therefore persistent selection
stored as needed).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19252 a592a061-630c-0410-9148-cb99ea01b6c8

src/CutAndPaste.cpp
src/Text3.cpp

index c34fc5d230d1dd5094fee2acd0d4ad6ed7d37a29..491d4a0e7612fe07190e2bc7e456e9ab2fa23ff2 100644 (file)
@@ -791,7 +791,6 @@ void pasteSelection(Cursor & cur, ErrorList & errorList)
        recordUndo(cur);
        pasteParagraphList(cur, selectionBuffer[0].first,
                           selectionBuffer[0].second, errorList);
-       cur.setSelection();
 }
 
 
index c879412f8ee4e272810b02638a1c8dbeaca9c0b4..157395564ac80fea66da12622e8192de7edafb78 100644 (file)
@@ -1015,43 +1015,34 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 
        // Single-click on work area
        case LFUN_MOUSE_PRESS: {
-               cap::saveSelection(bv->cursor());
                // Right click on a footnote flag opens float menu
                if (cmd.button() == mouse_button::button3)
                        cur.clearSelection();
 
-               // Middle button press pastes if we have a selection
-               // We do this here as if the selection was inside an inset
-               // it could get cleared on the unlocking of the inset so
-               // we have to check this first
-               bool paste_internally = false;
-               if (cmd.button() == mouse_button::button2 && cap::selection()) {
-                       // Copy the selection buffer to the clipboard
-                       // stack, because we want it to appear in the
-                       // "Edit->Paste recent" menu.
-                       cap::copySelectionToStack();
-                       paste_internally = true;
-               }
+               // Set the cursor
+               bool update = bv->mouseSetCursor(cur);
 
                // Insert primary selection with middle mouse
                // if there is a local selection in the current buffer,
                // insert this
                if (cmd.button() == mouse_button::button2) {
-                       if (paste_internally) {
-                               cap::pasteSelection(cur, bv->buffer()->errorList("Paste"));
+                       if (cap::selection()) {
+                               // Copy the selection buffer to the clipboard
+                               // stack, because we want it to appear in the
+                               // "Edit->Paste recent" menu.
+                               cap::copySelectionToStack();
+
+                               cap::pasteSelection(bv->cursor(), 
+                                                   bv->buffer()->errorList("Paste"));
                                bv->buffer()->errors("Paste");
-                               cur.clearSelection(); // bug 393
                                bv->buffer()->markDirty();
                                finishUndo();
                        } else {
-                               bv->mouseSetCursor(cur);
                                lyx::dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
                        }
                }
 
-               // we have to update after dePM triggered
-               bool update = bv->mouseSetCursor(cur);
-
+               // we have to update after dEPM triggered
                if (!update && cmd.button() == mouse_button::button1) {
                        needsUpdate = false;
                        cur.noUpdate();