Skip to content

Commit 903b1ff

Browse files
RadiumRadium
Radium
authored and
Radium
committed
feat: always_show_comments option
1 parent 74e31bc commit 903b1ff

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/rime/gear/script_translator.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ ScriptTranslator::ScriptTranslator(const Ticket& ticket)
130130
return;
131131
if (Config* config = engine_->schema()->config()) {
132132
config->GetInt(name_space_ + "/spelling_hints", &spelling_hints_);
133+
config->GetBool(name_space_ + "/always_show_comments", &always_show_comments_);
133134
}
134135
}
135136

@@ -345,7 +346,8 @@ an<Candidate> ScriptTranslation::Peek() {
345346
}
346347
if (sentence_->comment().empty()) {
347348
auto spelling = syllabifier_->GetOriginalSpelling(*sentence_);
348-
if (!spelling.empty() && spelling != sentence_->preedit()) {
349+
if (!spelling.empty() && (translator_->always_show_comments() ||
350+
spelling != sentence_->preedit())) {
349351
sentence_->set_comment(/*quote_left + */spelling/* + quote_right*/);
350352
}
351353
}

src/rime/gear/script_translator.h

+2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ class ScriptTranslator : public Translator,
3838

3939
// options
4040
int spelling_hints() const { return spelling_hints_; }
41+
bool always_show_comments() const { return always_show_comments_; }
4142

4243
protected:
4344
int spelling_hints_ = 0;
45+
bool always_show_comments_ = false;
4446
};
4547

4648
} // namespace rime

0 commit comments

Comments
 (0)