Unfortunately I have no idea how to proceed. I guess you should look
how src/frontends/Selection.h is implemented.

I understand that you are in a hurry, but do you have any idea, on the
top of your mind, why cur.selectionAsString(true) does not get
anything in event MOUSE_PRESS (patch attached), but would get the
selection in bv->owner()->dispatch(FuncRequest(LFUN_COPY)), executed
in MOUSE_PRESS before. Is there any subtle change between this cur,
and the cur passed again in dispatch(LFUN_COPY)?

Bo

+++ src/text3.C (working copy)
@@ -1077,28 +1077,16 @@
              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;
+               // why selectionAsString is empty?
+               std::cout<< cur.selectionAsString(false) << std::endl;
              if (cmd.button() == mouse_button::button2 && cur.selection()) {
-                       bv->owner()->dispatch(FuncRequest(LFUN_COPY));
-                       paste_internally = true;
-               }
-
+
bv->owner()->gui().selection().put(cur.selectionAsString(true));
+
              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)
-                               bv->owner()->dispatch(FuncRequest(LFUN_PASTE));
-                       else
-
bv->owner()->dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE,
"paragraph"));
-               }
-
+               if (cmd.button() == mouse_button::button2) {
+
bv->owner()->dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE,
"paragraph"));
+
              break;
      }

Reply via email to