]> git.lyx.org Git - features.git/commitdiff
First fix the spellchecker. Now, it find the next misspellec word.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 22 Jun 2009 17:30:57 +0000 (17:30 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 22 Jun 2009 17:30:57 +0000 (17:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30223 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp

index 86c555f8ee9b147f3e725ac7b99ee8b8f425cef0..d4aef40b13ff0652abf4b079ef7ab8007884c8e9 100644 (file)
@@ -3377,22 +3377,20 @@ int Buffer::spellCheck(DocIterator & from, DocIterator & to,
        int progress = 0;
        WordLangTuple wl;
        suggestions.clear();
+       word_lang = WordLangTuple();
+
        // We are only interested in text so remove the math CursorSlice.
        while (from.inMathed())
                from.pop_back();
 
        // OK, we start from here.
-       to = from;
-       while (!from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions)) {
-               ++progress;
-               if (from == to) {
-                       // end of file reached.
-                       word_lang = WordLangTuple();
-                       suggestions.clear();
-                       return progress;
-               }
+       DocIterator const end = doc_iterator_end(this);
+       for (; from != end; from.forwardPos()) {
+               to = from;
+               if (from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions))
+                       break;
                from = to;
-               from.forwardPos();
+               ++progress;
        }
        return progress;
 }