commit 4727e2becf6b69d79ead3df1708bfad95699ef6a
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Sun Aug 26 16:59:35 2018 +0200
Move leaveInset and isInside from CursorData to DocIterator
They only touch the slices of the main DocIterator.
---
src/Cursor.cpp | 20 --------------------
src/Cursor.h | 4 ----
src/DocIterator.cpp | 20 ++++++++++++++++++++
src/DocIterator.h | 4 ++++
4 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/Cursor.cpp b/src/Cursor.cpp
index ef9b837..fd43dd7 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 dcce849..2985543 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 895ebc6..d370e0a 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 4d2dfa0..0653de8 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;