]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
de.po
[lyx.git] / src / mathed / InsetMathNest.cpp
index 35f28e95c03436f1fe656ab9318c69024bf452ed..8cd1254098d2c0f125a8de5f31a5f096a5498296 100644 (file)
@@ -216,7 +216,7 @@ bool InsetMathNest::idxPrev(Cursor & cur) const
        if (cur.idx() == 0)
                return false;
        --cur.idx();
-       cur.pos() = cur.lastpos();
+       cur.pos() = lyxrc.mac_like_cursor_movement ? cur.lastpos() : 0;
        return true;
 }
 
@@ -793,12 +793,24 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_CELL_FORWARD:
                cur.screenUpdateFlags(Update::Decoration | Update::FitCursor);
-               cur.inset().idxNext(cur);
+               cur.selHandle(false);
+               cur.clearTargetX();
+               cur.macroModeClose();
+               if (!cur.inset().idxNext(cur)) {
+                       cur.idx() = firstIdx();
+                       cur.pos() = 0;
+               }
                break;
 
        case LFUN_CELL_BACKWARD:
                cur.screenUpdateFlags(Update::Decoration | Update::FitCursor);
-               cur.inset().idxPrev(cur);
+               cur.selHandle(false);
+               cur.clearTargetX();
+               cur.macroModeClose();
+               if (!cur.inset().idxPrev(cur)) {
+                       cur.idx() = lastIdx();
+                       cur.pos() = lyxrc.mac_like_cursor_movement ? cur.lastpos() : 0;
+               }
                break;
 
        case LFUN_WORD_DELETE_BACKWARD:
@@ -873,14 +885,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                        // via macro mode, we want to put the cursor inside it
                        // if relevant. Think typing "\frac<space>".
                        if (c == ' '
-                               && cur.inMacroMode() && cur.macroName() != "\\"
-                               && cur.macroModeClose() && cur.pos() > 0) {
-                               MathAtom const atom = cur.prevAtom();
-                               if (atom->asNestInset() && atom->isActive()) {
-                                       cur.posBackward();
-                                       cur.pushBackward(*cur.nextInset());
-                               }
-                       } else if (!interpretChar(cur, c)) {
+                           && cur.inMacroMode() && cur.macroName() != "\\"
+                           && cur.macroModeClose() && cur.pos() > 0)
+                               cur.editInsertedInset();
+                       else if (!interpretChar(cur, c)) {
                                cmd = FuncRequest(LFUN_FINISHED_FORWARD);
                                cur.undispatched();
                                // FIXME: can we avoid skipping the end of the string?