X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Frowpainter.cpp;h=47ab84d3a2b5e7130eb47cebc276b3ebc8dae163;hb=1e190a2af27ca99831f51567c16e6b39bf4317c3;hp=c11dc3b0d90d6963aba792df609ab20472cc6a46;hpb=ad76c66e338dfe4f9aae09429a30b205fe00e257;p=lyx.git diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index c11dc3b0d9..47ab84d3a2 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -38,6 +38,8 @@ #include "insets/InsetText.h" +#include "mathed/InsetMath.h" + #include "support/debug.h" #include "support/gettext.h" #include "support/textutils.h" @@ -392,7 +394,7 @@ void RowPainter::paintFromPos(pos_type & vpos, bool changed) lang == "farsi"; // spelling correct? - bool const misspelled_ = + bool const misspelled = lyxrc.spellcheck_continuously && par_.isMisspelled(pos); // draw as many chars as we can @@ -408,8 +410,23 @@ void RowPainter::paintFromPos(pos_type & vpos, bool changed) paintForeignMark(orig_x, orig_font.language()); - if (lyxrc.spellcheck_continuously && misspelled_) { - paintMisspelledMark(orig_x, changed); + if (lyxrc.spellcheck_continuously && misspelled) { + // check for cursor position + // don't draw misspelled marker for words at cursor position + // we don't want to disturb the process of text editing + BufferView const * bv = pi_.base.bv; + DocIterator const nw = bv->cursor().newWord(); + bool new_word = false; + if (!nw.empty() && par_.id() == nw.paragraph().id()) { + pos_type cpos = nw.pos(); + if (cpos > 0 && cpos == par_.size() && !par_.isWordSeparator(cpos-1)) + --cpos; + else if (cpos > 0 && par_.isWordSeparator(cpos)) + --cpos; + new_word = par_.isSameSpellRange(pos, cpos) ; + } + if (!new_word) + paintMisspelledMark(orig_x, changed); } } @@ -753,7 +770,10 @@ void RowPainter::paintOnlyInsets() // If outer row has changed, nested insets are repaint completely. Inset const * inset = par_.getInset(pos); bool const nested_inset = inset && - (inset->asInsetText() || inset->asInsetTabular()); + ((inset->asInsetMath() && + !inset->asInsetMath()->asMacroTemplate()) + || inset->asInsetText() + || inset->asInsetTabular()); if (!nested_inset) continue; if (x_ > pi_.base.bv->workWidth()