Skip to content

Commit 440a97c

Browse files
a8568730lotem
a8568730
authored andcommitted
fix(script_translator): always_show_comments also applies to phrases
Closes #272, Closes #419
1 parent ff7acdc commit 440a97c

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/rime/gear/script_translator.cc

+3-12
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ an<Candidate> ScriptTranslation::Peek() {
448448
}
449449
if (candidate_->comment().empty()) {
450450
auto spelling = syllabifier_->GetOriginalSpelling(*candidate_);
451-
if (!spelling.empty() && spelling != candidate_->preedit()) {
451+
if (!spelling.empty() &&
452+
(translator_->always_show_comments() ||
453+
spelling != candidate_->preedit())) {
452454
candidate_->set_comment(/*quote_left + */spelling/* + quote_right*/);
453455
}
454456
}
@@ -462,17 +464,6 @@ void ScriptTranslation::PrepareCandidate() {
462464
return;
463465
}
464466
if (sentence_) {
465-
if (sentence_->preedit().empty()) {
466-
sentence_->set_preedit(syllabifier_->GetPreeditString(*sentence_));
467-
}
468-
if (sentence_->comment().empty()) {
469-
auto spelling = syllabifier_->GetOriginalSpelling(*sentence_);
470-
if (!spelling.empty() &&
471-
(translator_->always_show_comments() ||
472-
spelling != sentence_->preedit())) {
473-
sentence_->set_comment(/*quote_left + */spelling/* + quote_right*/);
474-
}
475-
}
476467
candidate_ = sentence_;
477468
return;
478469
}

0 commit comments

Comments
 (0)