Skip to content

Commit

Permalink
fix(script_translator): always_show_comments also applies to phrases
Browse files Browse the repository at this point in the history
Closes #272, Closes #419
  • Loading branch information
a8568730 authored and lotem committed Jan 10, 2021
1 parent ff7acdc commit 440a97c
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/rime/gear/script_translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ an<Candidate> 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*/);
}
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 440a97c

Please sign in to comment.