]> git.lyx.org Git - lyx.git/blobdiff - src/EnchantChecker.cpp
typo
[lyx.git] / src / EnchantChecker.cpp
index 47eb35e52ec208eaa331a5ecaba3786c65e20212..5b42f33fde7e5f575a418d32e18c9ff476f63ffa 100644 (file)
@@ -90,7 +90,7 @@ enchant::Dict * EnchantChecker::Private::addSpeller(string const & lang)
                const char * what = e.what();
                LYXERR(Debug::FILES, "cannot add enchant speller: " <<
                           ((what && *what) ? what : "unspecified enchant exception in request_dict()"));
-               m.speller = 0;
+               m.speller = nullptr;
        }
        spellers_[lang] = m;
        return m.speller;
@@ -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;
 }