X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCursorSlice.cpp;h=573ca9d4fe71b653bd2b3e1e02401c11171891b8;hb=947c34364c7f6a5c12ddfa7286ff504c62a1038a;hp=e7ef90e8f37c3040e32aead6e0e595344f7a1d84;hpb=e52a38549328a58b6fe8efeecef21a71fb9c8d65;p=lyx.git diff --git a/src/CursorSlice.cpp b/src/CursorSlice.cpp index e7ef90e8f3..573ca9d4fe 100644 --- a/src/CursorSlice.cpp +++ b/src/CursorSlice.cpp @@ -80,19 +80,37 @@ 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_); +} + + +void CursorSlice::setPitPos(pit_type pit, pos_type pos) +{ + LASSERT(pit != int(text()->paragraphs().size()), return); + pit_ = pit; + pos_ = pos; + + // Now some strict checking. None of these should happen, but + // we're scaredy-cats + if (pos < 0) { + LYXERR0("Don't like -1!"); + LATTEST(false); + } + + if (pos > paragraph().size()) { + LYXERR0("Don't like 1, pos: " << pos + << " size: " << paragraph().size() + << " par: " << pit); + LATTEST(false); + } }