]> git.lyx.org Git - features.git/commitdiff
Move leaveInset and isInside from CursorData to DocIterator
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 26 Aug 2018 14:59:35 +0000 (16:59 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 30 Aug 2018 12:17:53 +0000 (14:17 +0200)
They only touch the slices of the main DocIterator.

src/Cursor.cpp
src/Cursor.h
src/DocIterator.cpp
src/DocIterator.h

index ef9b8375240f5b32a2de858d6f8556817c78c83b..fd43dd74ebb45e09a71aa3b64433c07e0674d2be 100644 (file)
@@ -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))
index dcce84920a43a6904aedf1c72a282cecf35f745a..2985543a4409f731c1faeeb5d9ca1bfd8d21d0dc 100644 (file)
@@ -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();
index 895ebc68c2211cd44b67b14a28e493b1d0200e27..d370e0a1e78176150561b24f19a79b6125b17f8e 100644 (file)
@@ -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) {
index 4d2dfa00f7eae7c808149fa9d9db6b5195b41399..0653de86e950b7f20286b5e8d5e9539ff4a1062c 100644 (file)
@@ -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;