From 19cea07e0f313e1dcb34b52f5fc9b37cba92a825 Mon Sep 17 00:00:00 2001 From: Radium Date: Wed, 22 Aug 2018 16:22:38 +1000 Subject: [PATCH] feat: always_show_comments option (#220) * feat: add always_show_comments option * fix: address feedback Line wraps --- src/rime/gear/script_translator.cc | 6 +++++- src/rime/gear/script_translator.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rime/gear/script_translator.cc b/src/rime/gear/script_translator.cc index 9853e508b..8a168c478 100644 --- a/src/rime/gear/script_translator.cc +++ b/src/rime/gear/script_translator.cc @@ -130,6 +130,8 @@ ScriptTranslator::ScriptTranslator(const Ticket& ticket) return; if (Config* config = engine_->schema()->config()) { config->GetInt(name_space_ + "/spelling_hints", &spelling_hints_); + config->GetBool(name_space_ + "/always_show_comments", + &always_show_comments_); } } @@ -345,7 +347,9 @@ an ScriptTranslation::Peek() { } if (sentence_->comment().empty()) { auto spelling = syllabifier_->GetOriginalSpelling(*sentence_); - if (!spelling.empty() && spelling != sentence_->preedit()) { + if (!spelling.empty() && + (translator_->always_show_comments() || + spelling != sentence_->preedit())) { sentence_->set_comment(/*quote_left + */spelling/* + quote_right*/); } } diff --git a/src/rime/gear/script_translator.h b/src/rime/gear/script_translator.h index 0a9c6d6e4..2eab5cf55 100644 --- a/src/rime/gear/script_translator.h +++ b/src/rime/gear/script_translator.h @@ -38,9 +38,11 @@ class ScriptTranslator : public Translator, // options int spelling_hints() const { return spelling_hints_; } + bool always_show_comments() const { return always_show_comments_; } protected: int spelling_hints_ = 0; + bool always_show_comments_ = false; }; } // namespace rime