diff --git a/src/Cursor.cpp b/src/Cursor.cpp index ef9b837524..fd43dd74eb 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -571,26 +571,6 @@ void CursorData::sanitize() } -bool CursorData::isInside(Inset const * p) const -{ - for (size_t i = 0; i != depth(); ++i) - if (&operator[](i).inset() == p) - return true; - return false; -} - - -void CursorData::leaveInset(Inset const & inset) -{ - for (size_t i = 0; i != depth(); ++i) { - if (&operator[](i).inset() == &inset) { - resize(i); - return; - } - } -} - - bool CursorData::undoAction() { if (!buffer()->undo().undoAction(*this)) diff --git a/src/Cursor.h b/src/Cursor.h index dcce84920a..2985543a44 100644 --- a/src/Cursor.h +++ b/src/Cursor.h @@ -171,10 +171,6 @@ public: /// Repopulate the slices insets from bottom to top. Useful /// for stable iterators or Undo data. void sanitize(); - /// - bool isInside(Inset const *) const; - /// make sure we are outside of given inset - void leaveInset(Inset const & inset); /// bool undoAction(); diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 895ebc68c2..d370e0a1e7 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -656,6 +656,26 @@ void DocIterator::sanitize() } +bool DocIterator::isInside(Inset const * p) const +{ + for (CursorSlice const & sl : slices_) + if (&sl.inset() == p) + return true; + return false; +} + + +void DocIterator::leaveInset(Inset const & inset) +{ + for (size_t i = 0; i != slices_.size(); ++i) { + if (&slices_[i].inset() == &inset) { + resize(i); + return; + } + } +} + + int DocIterator::find(MathData const & cell) const { for (size_t l = 0; l != slices_.size(); ++l) { diff --git a/src/DocIterator.h b/src/DocIterator.h index 4d2dfa00f7..0653de86e9 100644 --- a/src/DocIterator.h +++ b/src/DocIterator.h @@ -249,6 +249,10 @@ public: /// Repopulate the slices insets from bottom to top. Useful /// for stable iterators or Undo data. void sanitize(); + /// + bool isInside(Inset const *) const; + /// make sure we are outside of given inset + void leaveInset(Inset const & inset); /// find index of CursorSlice with &cell() == &cell (or -1 if not found) int find(MathData const & cell) const;