Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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