]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_cursor.C
cursor up/down; fix missing brace in write()
[features.git] / src / mathed / math_cursor.C
index dd60e72fdddb6620117b9e56eeb8b505ef09d8ed..124a770c4275d463ec029eb5fa765f256c05b253 100644 (file)
@@ -1172,12 +1172,15 @@ void MathCursor::splitCell()
 
 void MathCursor::breakLine()
 {
+       // leave inner cells
+       while (popRight())
+               ;
+
        MathMatrixInset * p = outerPar();
        if (p->getType() == LM_OT_SIMPLE || p->getType() == LM_OT_EQUATION) {
                p->mutate(LM_OT_EQNARRAY);
-               p->addRow(0);
-               idx() = p->nrows();
-               pos() = 0;
+               idx() = 0;
+               pos() = size();
        } else {
                p->addRow(row());
 
@@ -1271,6 +1274,11 @@ void MathCursor::gotoX(int x)
 
 bool MathCursor::goUp()
 {
+       // first ask the inset if it knows better then we
+       if (par()->idxUp(idx(), pos()))
+               return true;
+
+       // if not, apply brute force.
        int x0;
        int y0;
        getPos(x0, y0);
@@ -1288,6 +1296,11 @@ bool MathCursor::goUp()
 
 bool MathCursor::goDown()
 {
+       // first ask the inset if it knows better then we
+       if (par()->idxDown(idx(), pos()))
+               return true;
+
+       // if not, apply brute force.
        int x0;
        int y0;
        getPos(x0, y0);