]> git.lyx.org Git - lyx.git/blobdiff - src/CursorSlice.cpp
Revert 82c7669381
[lyx.git] / src / CursorSlice.cpp
index 0e46c0781fc760ac8e8783fcd099011db555151f..ae3686fd1ebf9417fc965a46490cfc5f52e09bf2 100644 (file)
@@ -80,19 +80,15 @@ pit_type CursorSlice::lastpit() const
 
 CursorSlice::row_type CursorSlice::row() const
 {
-       // LASSERT: This should only ever be called from an InsetMath.
-       // Should we crash in release mode, though, or try to continue?
-       LASSERT(asInsetMath(), /**/);
-       return asInsetMath()->row(idx_);
+       LASSERT(inset_, return 0);
+       return inset_->row(idx_);
 }
 
 
 CursorSlice::col_type CursorSlice::col() const
 {
-       // LASSERT: This should only ever be called from an InsetMath.
-       // Should we crash in release mode, though, or try to continue?
-       LASSERT(asInsetMath(), /**/);
-       return asInsetMath()->col(idx_);
+       LASSERT(inset_, return 0);
+       return inset_->col(idx_);
 }
 
 
@@ -158,15 +154,27 @@ void CursorSlice::backwardPos()
 }
 
 
-bool CursorSlice::at_end() const 
+bool CursorSlice::at_cell_end() const
 {
-       return idx_ == lastidx() && pit_ == lastpit() && pos_ == lastpos();
+       return pit_ == lastpit() && pos_ == lastpos();
+}
+
+
+bool CursorSlice::at_cell_begin() const
+{
+       return pit_ == 0 && pos_ == 0;
+}
+
+
+bool CursorSlice::at_end() const
+{
+       return idx_ == lastidx() && at_cell_end();
 }
 
 
 bool CursorSlice::at_begin() const
 {
-       return idx_ == 0 && pit_ == 0 && pos_ == 0;
+       return idx_ == 0 && at_cell_begin();
 }