]> git.lyx.org Git - lyx.git/blobdiff - src/EnchantChecker.cpp
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / EnchantChecker.cpp
index 66931fa07bbc557784b4eb356b5fb653df715ac1..5b42f33fde7e5f575a418d32e18c9ff476f63ffa 100644 (file)
@@ -118,7 +118,8 @@ EnchantChecker::~EnchantChecker()
 }
 
 
-SpellChecker::Result EnchantChecker::check(WordLangTuple const & word)
+SpellChecker::Result EnchantChecker::check(WordLangTuple const & word,
+        std::vector<WordLangTuple> const & docdict)
 {
        enchant::Dict * m = d->speller(word.lang()->code());
 
@@ -133,6 +134,14 @@ SpellChecker::Result EnchantChecker::check(WordLangTuple const & word)
        if (m->check(utf8word))
                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;
+       }
+
        return UNKNOWN_WORD;
 }