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 rime#272, Closes rime#419
  • Loading branch information
a8568730 authored and LEOYoon-Tsaw committed Jan 18, 2021
1 parent 4aff30d commit 012768b
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 012768b

Please sign in to comment.