]> git.lyx.org Git - features.git/blobdiff - src/cursor.C
shift small stuff from math cursor to cursor
[features.git] / src / cursor.C
index 919c68375a0b729a9e0f35193550716bc6085282..47b1d22152c6a37e369dd97716dcf5b00a666034 100644 (file)
@@ -26,6 +26,8 @@
 #include "insets/insettabular.h"
 #include "insets/insettext.h"
 
+#include "mathed/math_data.h"
+
 #include <boost/assert.hpp>
 
 using std::vector;
@@ -227,3 +229,49 @@ BufferView & LCursor::bv() const
 {
        return *bv_;
 }
+
+
+MathAtom const & LCursor::prevAtom() const
+{
+       BOOST_ASSERT(pos() > 0);
+       return cell()[pos() - 1];
+}
+
+
+MathAtom & LCursor::prevAtom()
+{
+       BOOST_ASSERT(pos() > 0);
+       return cell()[pos() - 1];
+}
+
+
+MathAtom const & LCursor::nextAtom() const
+{
+       BOOST_ASSERT(pos() < lastpos());
+       return cell()[pos()];
+}
+
+
+MathAtom & LCursor::nextAtom()
+{
+       BOOST_ASSERT(pos() < lastpos());
+       return cell()[pos()];
+}
+
+
+bool LCursor::posLeft()
+{
+       if (pos() == 0)
+               return false;
+       --pos();
+       return true;
+}
+
+
+bool LCursor::posRight()
+{
+       if (pos() == lastpos())
+               return false;
+       ++pos();
+       return true;
+}