X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FDocIterator.cpp;h=fe1250ff335bf5d91330d12c79ca7bf5c60f241a;hb=28be7d552f62cc02fa86d7f79201d089bfb2d7b5;hp=57286d9a6cbac47bd7cb11d551aa822720a528bb;hpb=41fda35c596bc9b70da7839cc7a3b8409fed82cc;p=lyx.git diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 57286d9a6c..fe1250ff33 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -26,6 +26,7 @@ #include "insets/InsetTabular.h" +#include "support/convert.h" #include "support/debug.h" #include "support/ExceptionMessage.h" #include "support/gettext.h" @@ -207,7 +208,7 @@ FontSpan DocIterator::locateWord(word_location const loc) const return f; } - + CursorSlice const & DocIterator::innerTextSlice() const { LBUFERR(!empty()); @@ -226,6 +227,14 @@ CursorSlice const & DocIterator::innerTextSlice() const } +docstring DocIterator::paragraphGotoArgument() const +{ + CursorSlice const & s = innerTextSlice(); + return convert(s.paragraph().id()) + ' ' + + convert(s.pos()); +} + + DocIterator DocIterator::getInnerText() const { DocIterator texted = *this; @@ -309,6 +318,24 @@ Inset * DocIterator::innerInsetOfType(int code) const } +bool DocIterator::posBackward() +{ + if (pos() == 0) + return false; + --pos(); + return true; +} + + +bool DocIterator::posForward() +{ + if (pos() == lastpos()) + return false; + ++pos(); + return true; +} + + // This duplicates code above, but is in the critical path. // So please think twice before adding stuff void DocIterator::forwardPos() @@ -535,7 +562,7 @@ bool DocIterator::fixIfBroken() size_t n = slices_.size(); for (; i != n; ++i) { CursorSlice & cs = slices_[i]; - if (&cs.inset() != inset) { + if (&cs.inset() != inset || cs.nargs() == 0) { // the whole slice is wrong, chop off this as well --i; LYXERR(Debug::DEBUG, "fixIfBroken(): inset changed");