]> git.lyx.org Git - lyx.git/blobdiff - src/AspellChecker.cpp
Make undo action no-ops when the buffer is read-only
[lyx.git] / src / AspellChecker.cpp
index 8e41765e3d70bb302adc14504a4582935f17466c..a5c54d8c74b6ae727e10526d29ef15f3d2cfddea 100644 (file)
@@ -428,7 +428,8 @@ AspellChecker::~AspellChecker()
 }
 
 
-SpellChecker::Result AspellChecker::check(WordLangTuple const & word)
+SpellChecker::Result AspellChecker::check(WordLangTuple const & word,
+                                         vector<WordLangTuple> const & docdict)
 {
        AspellSpeller * m = d->speller(word.lang());
 
@@ -439,6 +440,13 @@ SpellChecker::Result AspellChecker::check(WordLangTuple const & word)
                // MSVC compiled Aspell doesn't like it.
                return WORD_OK;
 
+       vector<WordLangTuple>::const_iterator it = docdict.begin();
+       for (; it != docdict.end(); ++it) {
+               if (it->lang()->code() != word.lang()->code())
+                       continue;
+               if (it->word() == word.word())
+                       return DOCUMENT_LEARNED_WORD;
+       }
        SpellChecker::Result rc = d->check(m, word);
        return (rc == WORD_OK && d->learned(word)) ? LEARNED_WORD : rc;
 }