Skip to content

Commit e7bb757

Browse files
committed
fix(simplifier): tips option for show_in_comment simplifier
1 parent 38389f1 commit e7bb757

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/gear/simplifier.cc

+9-6
Original file line numberDiff line numberDiff line change
@@ -194,16 +194,19 @@ void Simplifier::PushBack(const an<Candidate>& original,
194194
CandidateQueue* result, const string& simplified) {
195195
string tips;
196196
string text;
197+
size_t length = utf8::unchecked::distance(original->text().c_str(),
198+
original->text().c_str()
199+
+ original->text().length());
200+
bool show_tips = (tips_level_ == kTipsChar && length == 1) || tips_level_ == kTipsAll;
197201
if (show_in_comment_) {
198202
text = original->text();
199-
tips = simplified;
200-
comment_formatter_.Apply(&tips);
203+
if (show_tips) {
204+
tips = simplified;
205+
comment_formatter_.Apply(&tips);
206+
}
201207
} else {
202-
size_t length = utf8::unchecked::distance(original->text().c_str(),
203-
original->text().c_str()
204-
+ original->text().length());
205208
text = simplified;
206-
if ((tips_level_ == kTipsChar && length == 1) || tips_level_ == kTipsAll) {
209+
if (show_tips) {
207210
tips = original->text();
208211
bool modified = comment_formatter_.Apply(&tips);
209212
if (!modified) {

0 commit comments

Comments
 (0)