On 3-2-2011 18:27, sw...@lyx.org wrote:
Author: switt
Date: Thu Feb  3 18:27:13 2011
New Revision: 37463
URL: http://www.lyx.org/trac/changeset/37463

Log:
suppress the misspelled marker only when typing in a word the first time

Modified:
    lyx-devel/trunk/src/BufferView.cpp
    lyx-devel/trunk/src/Cursor.cpp
    lyx-devel/trunk/src/Cursor.h
    lyx-devel/trunk/src/DocIterator.cpp
    lyx-devel/trunk/src/DocIterator.h
    lyx-devel/trunk/src/Paragraph.h
    lyx-devel/trunk/src/rowpainter.cpp

Modified: lyx-devel/trunk/src/BufferView.cpp
==============================================================================
--- lyx-devel/trunk/src/BufferView.cpp  Thu Feb  3 17:32:28 2011        (r37462)
+++ lyx-devel/trunk/src/BufferView.cpp  Thu Feb  3 18:27:13 2011        (r37463)
@@ -700,6 +700,7 @@

  void BufferView::bookmarkEditPosition()
  {
+       d->cursor_.markEditPosition();
        // Don't eat cpu time for each keystroke
        if (d->cursor_.paragraph().id() == d->bookmark_edit_position_)
                return;

Why do you call markEditPosition here ? AFAICS, bookmarking the current position has nothing to do with checking for new words which is needed for inline spellchecking. Maybe, they need to be done at the same time, but we should then move the call further up the line.

Modified: lyx-devel/trunk/src/Cursor.cpp
==============================================================================
--- lyx-devel/trunk/src/Cursor.cpp      Thu Feb  3 17:32:28 2011        (r37462)
+++ lyx-devel/trunk/src/Cursor.cpp      Thu Feb  3 18:27:13 2011        (r37463)
@@ -503,6 +503,7 @@
  void Cursor::resetAnchor()
  {
        anchor_ = *this;
+       checkNewWordPosition();
  }

Why is the new word position check only when the anchor is reset ? I can't see the relationship here.



@@ -519,6 +520,54 @@
  }


+void Cursor::markEditPosition()
+{
+       if (inTexted()&&  new_word_.empty()) {
+               FontSpan ow = locateWord(WHOLE_WORD);
+               if (ow.size() == 1) {
+                       LYXERR(Debug::DEBUG, "start new word: "
+                               <<  " par: "<<  pit()
+                               <<  " pos: "<<  ow.first);
+                       new_word_ = *this;
+               }
+       }
+}
+

From the name of this function it is totally not clear that it sets new_word_ if a new word is 'born'. Moreover, later you add an "if (continuous_spellcheck)" which means this function does nothing when continuous spellchecking is not enabled, which is something I cannot possibly conclude from the name and or the comment in Cursor.h.

Vincent

Reply via email to