Author: switt
Date: Thu Mar 10 21:15:34 2011
New Revision: 37899
URL: http://www.lyx.org/trac/changeset/37899

Log:
better fix for regression introduced by r37463: crash when dissolving an inset. 
then the saved cursor slices of new_word_ are out of sync, add a check for 
count of nested insets

Modified:
   lyx-devel/trunk/src/Cursor.cpp

Modified: lyx-devel/trunk/src/Cursor.cpp
==============================================================================
--- lyx-devel/trunk/src/Cursor.cpp      Thu Mar 10 14:00:12 2011        (r37898)
+++ lyx-devel/trunk/src/Cursor.cpp      Thu Mar 10 21:15:34 2011        (r37899)
@@ -522,7 +522,7 @@
 
 void Cursor::markEditPosition()
 {
-       if (inTexted() && new_word_.empty()) {
+       if (lyxrc.spellcheck_continuously && inTexted() && new_word_.empty()) {
                FontSpan ow = locateWord(WHOLE_WORD);
                if (ow.size() == 1) {
                        LYXERR(Debug::DEBUG, "start new word: "
@@ -547,12 +547,15 @@
 
 void Cursor::checkNewWordPosition()
 {
-       if (new_word_.empty())
+       if (!lyxrc.spellcheck_continuously || new_word_.empty())
                return ;
        if (!inTexted())
                clearNewWordPosition();
        else {
-               if (pit() != new_word_.pit())
+               // forget the position of the current started word
+               // 1) the paragraph changes or
+               // 2) the count of nested insets changes
+               if (pit() != new_word_.pit() || depth() != new_word_.depth())
                        clearNewWordPosition();
                else {
                        FontSpan nw = locateWord(WHOLE_WORD);

Reply via email to