Could you check whether the attached patch makes a difference?

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)
Index: formulabase.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/formulabase.C,v
retrieving revision 1.146
diff -u -p -r1.146 formulabase.C
--- formulabase.C       15 Apr 2002 08:50:20 -0000      1.146
+++ formulabase.C       15 Apr 2002 12:31:03 -0000
@@ -152,15 +152,16 @@ string const InsetFormulaBase::editMessa
 }
 
 
-void InsetFormulaBase::edit(BufferView * bv, int x, int /*y*/, unsigned int)
+void InsetFormulaBase::edit(BufferView * bv, int x, int y, unsigned int)
 {
-       //lyxerr << "edit: " << x  << " " << y << " button: " << button << "\n";
        if (!bv->lockInset(this))
                lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl;
-
-       if (!mathcursor)
-               mathcursor = new MathCursor(this, x == 0);
+       delete mathcursor;
+       mathcursor = new MathCursor(this, true);
        metrics(bv);
+       mathcursor->setPos(x, y);
+       //lyxerr << "setting pos to " << x << "," << y << "\n";
+       
        // if that is removed, we won't get the magenta box when entering an
        // inset for the first time
        bv->updateInset(this, false);
@@ -169,8 +170,12 @@ void InsetFormulaBase::edit(BufferView *
 
 void InsetFormulaBase::edit(BufferView * bv, bool front)
 {
-       // looks hackish but seems to work
-       edit(bv, front ? 0 : 1, 0, 0);
+       if (!bv->lockInset(this))
+               lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl;
+       delete mathcursor;
+       mathcursor = new MathCursor(this, front);
+       metrics(bv);
+       bv->updateInset(this, false);
 }
 
 
@@ -191,8 +196,8 @@ void InsetFormulaBase::insetUnlock(Buffe
 void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const
 {
        mathcursor->getPos(x, y);
-       x += xo_;
-       y += yo_;
+       //x -= xo_;
+       y -= yo_;
        //lyxerr << "getCursorPos: " << x << " " << y << "\n";
 }
 
@@ -298,10 +303,9 @@ void InsetFormulaBase::insetButtonPress(
                default:
                case 1:
                        // left click
-                       if (!mathcursor) {
-                               mathcursor = new MathCursor(this, x == 0);
-                               metrics(bv);
-                       } 
+                       delete mathcursor;
+                       mathcursor = new MathCursor(this, x == 0);
+                       metrics(bv);
                        first_x = x;
                        first_y = y;
                        mathcursor->selClear();

Reply via email to