]> git.lyx.org Git - lyx.git/blobdiff - src/rowpainter.cpp
Revert r37704. It enabled SET_TABULAR_WIDTH for all longtables (new fix coming soon)
[lyx.git] / src / rowpainter.cpp
index bb529748bb653cfb397a4ce370116159c7efa03f..47ab84d3a2b5e7130eb47cebc276b3ebc8dae163 100644 (file)
@@ -394,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
@@ -410,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);
        }
 }