diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index a2dc9cea2d..e40b958c45 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -254,6 +254,22 @@ bool MathMacro::idxLast(Cursor & cur) const } +bool MathMacro::idxUpDown(Cursor & cur, bool up) const +{ + if (up) { + if (cur.idx() == 0) + return false; + --cur.idx(); + } else { + if (cur.idx() + 1 >= nargs()) + return false; + ++cur.idx(); + } + cur.pos() = cell(cur.idx()).x2pos(cur.x_target()); + return true; +} + + bool MathMacro::notifyCursorLeaves(Cursor & cur) { cur.updateFlags(Update::Force); diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 6193ec62fe..8e9f1b23d0 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -48,6 +48,8 @@ public: /// target pos when we enter the inset from the right by pressing "Left" bool idxLast(Cursor &) const; /// + bool idxUpDown(Cursor & cur, bool up) const; + /// virtual bool notifyCursorLeaves(Cursor &); /// docstring name() const;