]> git.lyx.org Git - features.git/blobdiff - src/DocIterator.cpp
The way this was done here is inconsistent with how it is done
[features.git] / src / DocIterator.cpp
index e574115c31be85de4349a1ef7ab1e60db2e19f2a..352aa3a65e74831d25089ad882cf570d2c7c41b3 100644 (file)
@@ -449,6 +449,28 @@ void DocIterator::backwardPos()
 }
 
 
+#if 0
+// works, but currently not needed
+void DocIterator::backwardInset()
+{
+       backwardPos();
+
+       while (!empty() && !nextInset()) {
+               if (inTexted()) {
+                       pos_type const lastp = lastpos();
+                       Paragraph const & par = paragraph();
+                       pos_type & pos = top().pos();
+                       while (pos > 0 && (pos == lastp || !par.isInset(pos)))
+                               --pos;
+                       if (pos > 0)
+                               break;
+               }
+               backwardPos();
+       }
+}
+#endif
+
+
 bool DocIterator::hasPart(DocIterator const & it) const
 {
        // it can't be a part if it is larger
@@ -460,6 +482,19 @@ bool DocIterator::hasPart(DocIterator const & it) const
 }
 
 
+bool DocIterator::allowSpellCheck() const
+{
+       /// spell check is disabled if the iterator position
+       /// is inside of an inset which disables the spell checker
+       size_t const n = depth();
+       for (size_t i = 0; i < n; ++i) {
+               if (!slices_[i].inset_->allowSpellCheck())
+                       return false;
+       }
+       return true;
+}
+
+
 void DocIterator::updateInsets(Inset * inset)
 {
        // this function re-creates the cache of inset pointers.
@@ -555,8 +590,8 @@ void DocIterator::sanitize()
                        fixIfBroken();
                        break;
                }
-               if (!inset->editable()) {
-                       LYXERR0("Inset found on cursor stack is not editable.");
+               if (!inset->isActive()) {
+                       LYXERR0("Inset found on cursor stack is not active.");
                        fixIfBroken();
                        break;
                }