X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FEnchantChecker.cpp;h=8cc37812b4c7e558c57331bde91b63c98611b11b;hb=badbd3dcc344f125e301a795c33d2c67cde8d97e;hp=3f3b138f58a0d36a7f27f36758b4b4ca515832e8;hpb=6f82f85228801eccf1ed7afba18a7499337136ee;p=lyx.git diff --git a/src/EnchantChecker.cpp b/src/EnchantChecker.cpp index 3f3b138f58..8cc37812b4 100644 --- a/src/EnchantChecker.cpp +++ b/src/EnchantChecker.cpp @@ -112,31 +112,41 @@ SpellChecker::Result EnchantChecker::check(WordLangTuple const & word) { enchant::Dict * m = d->speller(word.lang()->code()); - if (!m) - return OK; + if (!m || word.word().empty()) + return WORD_OK; string utf8word = to_utf8(word.word()); if (m->check(utf8word)) - return OK; + return WORD_OK; return UNKNOWN_WORD; } +void EnchantChecker::advanceChangeNumber() +{ + nextChangeNumber(); +} + + void EnchantChecker::insert(WordLangTuple const & word) { Spellers::iterator it = d->spellers_.find(word.lang()->code()); - if (it != d->spellers_.end()) + if (it != d->spellers_.end()) { it->second.speller->add(to_utf8(word.word())); + advanceChangeNumber(); + } } void EnchantChecker::accept(WordLangTuple const & word) { Spellers::iterator it = d->spellers_.find(word.lang()->code()); - if (it != d->spellers_.end()) + if (it != d->spellers_.end()) { it->second.speller->add_to_session(to_utf8(word.word())); + advanceChangeNumber(); + } }