diff --git a/src/rime/gear/script_translator.cc b/src/rime/gear/script_translator.cc index 028b659e58..50b5555286 100644 --- a/src/rime/gear/script_translator.cc +++ b/src/rime/gear/script_translator.cc @@ -176,6 +176,10 @@ ScriptTranslator::ScriptTranslator(const Ticket& ticket) config->GetBool(name_space_ + "/always_show_comments", &always_show_comments_); config->GetBool(name_space_ + "/enable_correction", &enable_correction_); + if (!config->GetBool(name_space_ + "/enable_word_completion", + &enable_word_completion_)) { + enable_word_completion_ = enable_completion_; + } config->GetInt(name_space_ + "/max_homophones", &max_homophones_); poet_.reset(new Poet(language(), config)); } @@ -361,8 +365,8 @@ static bool has_exact_match_phrase(Ptr ptr, Iter iter, size_t consumed) { bool ScriptTranslation::Evaluate(Dictionary* dict, UserDictionary* user_dict) { size_t consumed = syllabifier_->BuildSyllableGraph(*dict->prism()); const auto& syllable_graph = syllabifier_->syllable_graph(); - bool predict_word = - translator_->enable_completion() && start_ + consumed == end_of_input_; + bool predict_word = translator_->enable_word_completion() && + start_ + consumed == end_of_input_; phrase_ = dict->Lookup(syllable_graph, 0, predict_word); if (user_dict) { diff --git a/src/rime/gear/script_translator.h b/src/rime/gear/script_translator.h index f13a37eaa1..63f6b39159 100644 --- a/src/rime/gear/script_translator.h +++ b/src/rime/gear/script_translator.h @@ -41,12 +41,14 @@ class ScriptTranslator : public Translator, int max_homophones() const { return max_homophones_; } int spelling_hints() const { return spelling_hints_; } bool always_show_comments() const { return always_show_comments_; } + bool enable_word_completion() const { return enable_word_completion_; } protected: int max_homophones_ = 1; int spelling_hints_ = 0; bool always_show_comments_ = false; bool enable_correction_ = false; + bool enable_word_completion_ = false; the corrector_; the poet_; };