http://bugzilla.lyx.org/show_bug.cgi?id=2779

This patch fixes button2 use in maths. It is now able to paste current
in-lyx selection when it is present.

Please test.

JMarc

Index: src/mathed/math_nestinset.C
===================================================================
--- src/mathed/math_nestinset.C	(revision 14801)
+++ src/mathed/math_nestinset.C	(working copy)
@@ -1032,18 +1032,22 @@
 void MathNestInset::lfunMousePress(LCursor & cur, FuncRequest & cmd)
 {
 	//lyxerr << "## lfunMousePress: buttons: " << cmd.button() << endl;
+	BufferView & bv = cur.bv();
 	if (cmd.button() == mouse_button::button1) {
 		//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
-		cur.bv().mouseSetCursor(cur);
+		bv.mouseSetCursor(cur);
 	}
 
 	if (cmd.button() == mouse_button::button2) {
 		MathArray ar;
-		asArray(cur.bv().getClipboard(), ar);
-		cur.clearSelection();
-		editXY(cur, cmd.x, cmd.y);
+		if (cur.selection())
+			asArray(bv.cursor().selectionAsString(false), ar);
+		else
+			asArray(bv.getClipboard(), ar);
+
 		cur.insert(ar);
-		cur.bv().update();
+		bv.mouseSetCursor(cur);
+		bv.update();
 		return;
 	}
 }

Reply via email to