X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCursorSlice.cpp;h=c5be12f5000a6c6b6dc771036b5228609837a078;hb=1e519d1115f41f71c253cb9e2fbb7803e9a583a9;hp=ae3686fd1ebf9417fc965a46490cfc5f52e09bf2;hpb=c54b1368801d06ed740a24879721dfe599b2166a;p=lyx.git diff --git a/src/CursorSlice.cpp b/src/CursorSlice.cpp index ae3686fd1e..c5be12f500 100644 --- a/src/CursorSlice.cpp +++ b/src/CursorSlice.cpp @@ -23,7 +23,7 @@ #include "insets/Inset.h" #include "mathed/InsetMath.h" -#include "mathed/MathMacro.h" +#include "mathed/InsetMathMacro.h" #include "support/ExceptionMessage.h" #include "support/gettext.h" @@ -65,7 +65,7 @@ pos_type CursorSlice::lastpos() const LBUFERR(inset_); InsetMath const * math = inset_->asInsetMath(); bool paramless_macro = math && math->asMacro() && !math->asMacro()->nargs(); - return math ? (paramless_macro ? 0 : cell().size()) + return math ? (paramless_macro ? 0 : cell().size()) : (text()->empty() ? 0 : paragraph().size()); } @@ -92,6 +92,28 @@ CursorSlice::col_type CursorSlice::col() const } +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); + } +} + + void CursorSlice::forwardPos() { // move on one position if possible