Skip to content

Commit

Permalink
fix(simplifier): tips option for show_in_comment simplifier
Browse files Browse the repository at this point in the history
  • Loading branch information
osfans committed Dec 22, 2016
1 parent 38389f1 commit e7bb757
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/gear/simplifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,19 @@ void Simplifier::PushBack(const an<Candidate>& original,
CandidateQueue* result, const string& simplified) {
string tips;
string text;
size_t length = utf8::unchecked::distance(original->text().c_str(),
original->text().c_str()
+ original->text().length());
bool show_tips = (tips_level_ == kTipsChar && length == 1) || tips_level_ == kTipsAll;
if (show_in_comment_) {
text = original->text();
tips = simplified;
comment_formatter_.Apply(&tips);
if (show_tips) {
tips = simplified;
comment_formatter_.Apply(&tips);
}
} else {
size_t length = utf8::unchecked::distance(original->text().c_str(),
original->text().c_str()
+ original->text().length());
text = simplified;
if ((tips_level_ == kTipsChar && length == 1) || tips_level_ == kTipsAll) {
if (show_tips) {
tips = original->text();
bool modified = comment_formatter_.Apply(&tips);
if (!modified) {
Expand Down

0 comments on commit e7bb757

Please sign in to comment.