+void CursorSlice::forwardPos()
+{
+ // move on one position if possible
+ if (pos_ < lastpos()) {
+ //lyxerr << "... next pos" << endl;
+ ++pos_;
+ return;
+ }
+
+ // otherwise move on one paragraph if possible
+ if (pit_ < lastpit()) {
+ //lyxerr << "... next par" << endl;
+ ++pit_;
+ pos_ = 0;
+ return;
+ }
+
+ // otherwise move on one cell
+ //lyxerr << "... next idx" << endl;
+
+ LASSERT(idx_ < nargs(), /**/);
+
+ ++idx_;
+ pit_ = 0;
+ pos_ = 0;
+}
+
+
+void CursorSlice::forwardIdx()
+{
+ LASSERT(idx_ < nargs(), /**/);
+
+ ++idx_;
+ pit_ = 0;
+ pos_ = 0;
+}
+
+
+void CursorSlice::backwardPos()
+{
+ if (pos_ != 0) {
+ --pos_;
+ return;
+ }
+
+ if (pit_ != 0) {
+ --pit_;
+ pos_ = lastpos();
+ return;
+ }
+
+ if (idx_ != 0) {
+ --idx_;
+ pit_ = lastpit();
+ pos_ = lastpos();
+ return;
+ }
+
+ LASSERT(false, /**/);
+}
+
+
+bool CursorSlice::at_end() const
+{
+ return idx_ == lastidx() && pit_ == lastpit() && pos_ == lastpos();
+}
+
+
+bool CursorSlice::at_begin() const
+{
+ return idx_ == 0 && pit_ == 0 && pos_ == 0;
+}
+
+