Skip to content

Commit 19cea07

Browse files
ztl8702lotem
authored andcommitted
feat: always_show_comments option (#220)
* feat: add always_show_comments option * fix: address feedback Line wraps
1 parent 74e31bc commit 19cea07

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/rime/gear/script_translator.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ 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",
134+
&always_show_comments_);
133135
}
134136
}
135137

@@ -345,7 +347,9 @@ an<Candidate> ScriptTranslation::Peek() {
345347
}
346348
if (sentence_->comment().empty()) {
347349
auto spelling = syllabifier_->GetOriginalSpelling(*sentence_);
348-
if (!spelling.empty() && spelling != sentence_->preedit()) {
350+
if (!spelling.empty() &&
351+
(translator_->always_show_comments() ||
352+
spelling != sentence_->preedit())) {
349353
sentence_->set_comment(/*quote_left + */spelling/* + quote_right*/);
350354
}
351355
}

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)