The document iterator now skips math insets and insets like notes where spell check is disabled.
The continuous spell checking is part of the row painter drawing and the spell check disabled state
has to be passed down recursively while doing the inset painting.
// OK, we start from here.
for (; from != end; from.forwardPos()) {
// We are only interested in text so remove the math CursorSlice.
- while (from.inMathed()) {
+ // The same is done for insets with disabled spell check.
+ while (from.inMathed() || !from.inset().allowSpellCheck()) {
from.pop_back();
from.pos()++;
}
// If from is at the end of the document (which is possible
- // when leaving the mathed) LyX will crash later otherwise.
+ // when "from" was manipulated) LyX will crash later otherwise.
if (from.atEnd() || (!to_end && from >= end))
break;
to = from;
word_lang = wl;
break;
}
-
// Do not increase progress when from == to, otherwise the word
// count will be wrong.
if (from != to) {
PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
: pain(painter), ltr_pos(false), change_(), selected(false),
- full_repaint(true), background_color(Color_background)
+ do_spellcheck(true), full_repaint(true), background_color(Color_background)
{
base.bv = bv;
}
Change change_;
/// Whether the parent is selected as a whole
bool selected;
+ /// Whether the spell checker is enabled for the parent
+ bool do_spellcheck;
///
bool full_repaint;
/// Current background color
LASSERT(inset, return);
// Backup full_repaint status because some insets (InsetTabular)
// requires a full repaint
- bool pi_full_repaint = pi_.full_repaint;
+ bool const pi_full_repaint = pi_.full_repaint;
+ bool const pi_do_spellcheck = pi_.do_spellcheck;
pi_.base.font = inset->inheritFont() ? font.fontInfo() :
pi_.base.bv->buffer().params().getFont().fontInfo();
pi_.ltr_pos = (bidi_.level(pos) % 2 == 0);
Change prev_change = change_;
pi_.change_ = change_.changed() ? change_ : par_.lookupChange(pos);
+ pi_.do_spellcheck &= inset->allowSpellCheck();
int const x1 = int(x_);
pi_.base.bv->coordCache().insets().add(inset, x1, yo_);
// Restore full_repaint status.
pi_.full_repaint = pi_full_repaint;
pi_.change_ = prev_change;
+ pi_.do_spellcheck = pi_do_spellcheck;
#ifdef DEBUG_METRICS
int const x2 = x1 + dim.wid;
|| rowSlice == bv_->lastRowSlice();
// Take this opportunity to spellcheck the row contents.
- if (row_has_changed && lyxrc.spellcheck_continuously) {
+ if (row_has_changed && pi.do_spellcheck && lyxrc.spellcheck_continuously) {
text_->getPar(pit).spellCheck();
}