This is the old patch in:
http://bugzilla.lyx.org/show_bug.cgi?id=2251

I applied it to trunk, and I would like to apply it to 1.4 too. Please
test.

JMarc

Index: src/mathed/math_hullinset.C
===================================================================
--- src/mathed/math_hullinset.C	(Revision 13253)
+++ src/mathed/math_hullinset.C	(Arbeitskopie)
@@ -269,7 +269,7 @@
 		// insert a one pixel gap in front of the formula
 		dim.wid += 1;
 		if (display())
-			dim.des += 12;
+			dim.des += displayMargin();
 		dim_ = dim;
 		return;
 	}
@@ -281,8 +281,8 @@
 	MathGridInset::metrics(mi, dim);
 
 	if (display()) {
-		dim.asc += 12;
-		dim.des += 12;
+		dim.asc += displayMargin();
+		dim.des += displayMargin();
 	}
 
 	if (numberedType()) {
Index: src/mathed/math_hullinset.h
===================================================================
--- src/mathed/math_hullinset.h	(Revision 13253)
+++ src/mathed/math_hullinset.h	(Arbeitskopie)
@@ -119,6 +119,8 @@
 	///
 	void addPreview(lyx::graphics::PreviewLoader &) const;
 
+	///
+	static int displayMargin() { return 12; }
 
 protected:
 	MathHullInset(MathHullInset const &);
Index: src/text2.C
===================================================================
--- src/text2.C	(Revision 13253)
+++ src/text2.C	(Arbeitskopie)
@@ -51,6 +51,8 @@
 
 #include "insets/insetenv.h"
 
+#include "mathed/math_hullinset.h"
+
 #include "support/textutils.h"
 
 #include <boost/current_function.hpp>
@@ -1051,7 +1053,10 @@
 	if (!cur.selection()) {
 		int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
 		LCursor old = cur;
-		editXY(cur, x, y - par.rows()[row].ascent() - 1);
+		// Go to middle of previous row. 16 found to work OK;
+		// 12 = top/bottom margin of display math
+		int const margin = 3 * MathHullInset::displayMargin() / 2;
+		editXY(cur, x, y - par.rows()[row].ascent() - margin);
 		cur.clearSelection();
 
 		// This happens when you move out of an inset.
@@ -1097,7 +1102,9 @@
 	if (!cur.selection()) {
 		int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
 		LCursor old = cur;
-		editXY(cur, x, y + par.rows()[row].descent() + 1);
+		// To middle of next row
+		int const margin = 3 * MathHullInset::displayMargin() / 2;
+		editXY(cur, x, y + par.rows()[row].descent() + margin);
 		cur.clearSelection();
 
 		// This happens when you move out of an inset.

Reply via email to