Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return an empty string when no result in zh-CN codebook #3496

Merged
merged 1 commit into from
Jun 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ public CandidatesResult getCandidates(String aComposingText) {
tempKey = tempKey.substring(0, tempKey.length() - 1);
}
}

// We can't find available candidates, so using the composing text
// as the only item of candidates.
if (candidate.length() == 0) {
candidate.append(aComposingText);
}
words.add(new Words(syllables, code.toString(), candidate.toString()));

// Extra candidates
Expand Down Expand Up @@ -187,6 +193,11 @@ public String getComposingText(String aComposing, String aCode) {
}
}
}
// If we don't have a text code from the code book,
// just return an empty string to do composing.
if (aCode.isEmpty()) {
return "";
}
return aComposing.replaceFirst(Pattern.quote(aCode), "");
}

Expand Down