Jean-Marc Lasgouttes wrote:
"Bo Peng" <[EMAIL PROTECTED]> writes:
Jose, can you wait a bit for the fix of this one? Should be a one
liner somewhere.
I submitted a quick fix (r19199). It can be reverted if JMarc has some
better idea.

Here is the fix I would propose. It ensures that the cursor is set
through BufferView::mouseSetCursor, so that the selection is always
tracked correctly. The patch is a little longer because I used the
occasion to slightly cleanup the code (I do not think the two-parts
handling of mouse2 is really useful).

The change in CutAndPaste is unrelated but makes sense: the other
pasting operations do not select the pasted text...
Would it be possible to get 2304 taken care of here? I.e., shift+mouse selects from old location to new location? That must be right here.

rh
Index: src/Text3.cpp
===================================================================
--- src/Text3.cpp       (révision 19249)
+++ src/Text3.cpp       (copie de travail)
@@ -1015,43 +1015,34 @@ void Text::dispatch(Cursor & cur, FuncRe
// 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();


--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Reply via email to