X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Frowpainter.cpp;h=47ab84d3a2b5e7130eb47cebc276b3ebc8dae163;hb=e2982037d9f981a6070c3cf90148bde33edbfdc9;hp=5fe34d792e41724cba988a1c9850b117276b03dd;hpb=fab1507221a1d1d70bf4f60522c7e74beec8db1c;p=lyx.git diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 5fe34d792e..47ab84d3a2 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -415,15 +415,17 @@ void RowPainter::paintFromPos(pos_type & vpos, bool changed) // 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; - Cursor const & cur = bv->cursor(); - bool current_word = false; - if (par_.id() == cur.paragraph().id()) { - pos_type cpos = cur.pos(); + 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; - current_word = par_.isSameSpellRange(pos, cpos) ; + else if (cpos > 0 && par_.isWordSeparator(cpos)) + --cpos; + new_word = par_.isSameSpellRange(pos, cpos) ; } - if (!current_word) + if (!new_word) paintMisspelledMark(orig_x, changed); } }