From 012768b3de57f0894d2eaf7a91084842ea6c4586 Mon Sep 17 00:00:00 2001 From: a8568730 Date: Wed, 18 Nov 2020 11:10:24 +0800 Subject: [PATCH] fix(script_translator): always_show_comments also applies to phrases Closes #272, Closes #419 --- src/rime/gear/script_translator.cc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/rime/gear/script_translator.cc b/src/rime/gear/script_translator.cc index c7fa1d822a..4a45f05e6e 100644 --- a/src/rime/gear/script_translator.cc +++ b/src/rime/gear/script_translator.cc @@ -448,7 +448,9 @@ an ScriptTranslation::Peek() { } if (candidate_->comment().empty()) { auto spelling = syllabifier_->GetOriginalSpelling(*candidate_); - if (!spelling.empty() && spelling != candidate_->preedit()) { + if (!spelling.empty() && + (translator_->always_show_comments() || + spelling != candidate_->preedit())) { candidate_->set_comment(/*quote_left + */spelling/* + quote_right*/); } } @@ -462,17 +464,6 @@ void ScriptTranslation::PrepareCandidate() { return; } if (sentence_) { - if (sentence_->preedit().empty()) { - sentence_->set_preedit(syllabifier_->GetPreeditString(*sentence_)); - } - if (sentence_->comment().empty()) { - auto spelling = syllabifier_->GetOriginalSpelling(*sentence_); - if (!spelling.empty() && - (translator_->always_show_comments() || - spelling != sentence_->preedit())) { - sentence_->set_comment(/*quote_left + */spelling/* + quote_right*/); - } - } candidate_ = sentence_; return; }