"Bo Peng" <[EMAIL PROTECTED]> writes:

>> Under Linux, I'm having problems with mouse selection, using current
>> 1.6svn---though not, oddly enough, in 1.5.2svn.
>
> Before 1.5.1 is released, I added a quick fix to trunk to fix middle
> button paste. JMarc is supposed to replace that with a better fix of
> his, and fix the trunk as well. See
> http://marc.info/?l=lyx-devel&m=118617753604863&w=2

I do not know whether it will help Richard, but anyway here are my
promised patches. Bo, can you do some testing? 

Note that I removed all the pasting code for tabular and directed to
InsetText instead. However the two code were a bit different and I do
not know why. Could you review the patch? 

JMarc

svndiff src/insets/InsetTabular.cpp src/mathed/InsetMathNest.cpp

Index: src/insets/InsetTabular.cpp
===================================================================
--- src/insets/InsetTabular.cpp	(révision 19388)
+++ src/insets/InsetTabular.cpp	(copie de travail)
@@ -3189,10 +3189,6 @@ void InsetTabular::doDispatch(Cursor & c
 
 	case LFUN_MOUSE_PRESS:
 		//lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl;
-		// FIXME: the following should be replaced by a better fix
-		// that is already used for plain text (Text3.cpp).
-		cap::saveSelection(bvcur);
-
 		if (cmd.button() == mouse_button::button1
 		    || (cmd.button() == mouse_button::button3
 			&& (&bvcur.selBegin().inset() != this || !tablemode(bvcur)))) {
@@ -3204,22 +3200,10 @@ void InsetTabular::doDispatch(Cursor & c
 			break;
 		}
 
-		if (cmd.button() == mouse_button::button2) {
-			if (cap::selection()) {
-				// See comment in Text::dispatch why we
-				// do this
-				// FIXME This does not use paste_tabular,
-				// another reason why paste_tabular should go.
-				cap::copySelectionToStack();
-				cmd = FuncRequest(LFUN_PASTE, "0");
-			} else {
-				cmd = FuncRequest(LFUN_PRIMARY_SELECTION_PASTE,
-						  "paragraph");
-			}
-			doDispatch(cur, cmd);
-			cur.bv().buffer()->markDirty();
-			cur.bv().mouseSetCursor(cur);
-		}
+		if (cmd.button() == mouse_button::button2)
+			// Let InsetText do it
+			cell(cur.idx())->dispatch(cur, cmd);
+
 		break;
 
 	case LFUN_MOUSE_MOTION:
Index: src/mathed/InsetMathNest.cpp
===================================================================
--- src/mathed/InsetMathNest.cpp	(révision 19388)
+++ src/mathed/InsetMathNest.cpp	(copie de travail)
@@ -1155,30 +1155,30 @@ void InsetMathNest::lfunMousePress(Curso
 	BufferView & bv = cur.bv();
 	// FIXME: the following should be replaced by a better fix
 	// that is already used for plain text (Text3.cpp).
-	cap::saveSelection(bv.cursor());
+	bv.mouseSetCursor(cur);
 	if (cmd.button() == mouse_button::button1) {
 		//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
-		bv.mouseSetCursor(cur);
 		// Update the cursor update flags as needed:
 		//
-		// Update::Decoration: tells to update the decoration (visual box
-		//                     corners that define the inset)/
-		// Update::FitCursor: adjust the screen to the cursor position if
-		//                    needed
+		// Update::Decoration: tells to update the decoration
+		//                     (visual box corners that define
+		//                     the inset)/
+		// Update::FitCursor: adjust the screen to the cursor
+		//                    position if needed
 		// cur.result().update(): don't overwrite previously set flags.
-		cur.updateFlags(Update::Decoration | Update::FitCursor | cur.result().update());
+		cur.updateFlags(Update::Decoration | Update::FitCursor 
+				| cur.result().update());
 	} else if (cmd.button() == mouse_button::button2) {
-		MathData ar;
 		if (cap::selection()) {
 			// See comment in Text::dispatch why we do this
 			cap::copySelectionToStack();
 			cmd = FuncRequest(LFUN_PASTE, "0");
-			doDispatch(cur, cmd);
-		} else
+			doDispatch(bv.cursor(), cmd);
+		} else {
+			MathData ar;
 			asArray(theSelection().get(), ar);
-
-		cur.insert(ar);
-		bv.mouseSetCursor(cur);
+			bv.cursor().insert(ar);
+		}
 	}
 }
 

Reply via email to