DocIterator const end = to_end ? doc_iterator_end(this) : to;
// OK, we start from here.
for (; from != end; from.forwardPos()) {
- // We are only interested in text so remove the math CursorSlice.
- // The same is done for insets with disabled spell check.
- while (from.inMathed() || !from.inset().allowSpellCheck()) {
+ // This skips all insets with spell check disabled.
+ while (!from.allowSpellCheck()) {
from.pop_back();
from.pos()++;
}
// If from is at the end of the document (which is possible
- // when "from" was manipulated) LyX will crash later otherwise.
+ // when "from" was changed above) LyX will crash later otherwise.
if (from.atEnd() || (!to_end && from >= end))
break;
to = from;
}
+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.
/// is this the last possible position?
bool atLastPos() const { return pit() == lastpit() && pos() == lastpos(); }
+ /// checks the cursor slices for disabled spell checker insets
+ bool allowSpellCheck() const;
+
//
// access to slice at tip
//
--cpos;
new_word = par_.isSameSpellRange(pos, cpos) ;
}
- if (!new_word)
- paintMisspelledMark(orig_x, changed);
+ if (!new_word && pi_.do_spellcheck)
+ paintMisspelledMark(orig_x, changed, font);
}
}