X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FEnchantChecker.cpp;h=5b42f33fde7e5f575a418d32e18c9ff476f63ffa;hb=7067f48fa7afb89575abc58495d076078ce20137;hp=47eb35e52ec208eaa331a5ecaba3786c65e20212;hpb=63a4e82874fddcec00a1733c14ad4525d155f19f;p=lyx.git diff --git a/src/EnchantChecker.cpp b/src/EnchantChecker.cpp index 47eb35e52e..5b42f33fde 100644 --- a/src/EnchantChecker.cpp +++ b/src/EnchantChecker.cpp @@ -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 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::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; }