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

Commit b36aaa6

Browse files
authored
Return an empty string for composing text when no result in zh-CN codebook. (#3496)
1 parent 7f14793 commit b36aaa6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

app/src/common/shared/org/mozilla/vrbrowser/ui/keyboards/ChinesePinyinKeyboard.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ public CandidatesResult getCandidates(String aComposingText) {
124124
tempKey = tempKey.substring(0, tempKey.length() - 1);
125125
}
126126
}
127+
128+
// We can't find available candidates, so using the composing text
129+
// as the only item of candidates.
130+
if (candidate.length() == 0) {
131+
candidate.append(aComposingText);
132+
}
127133
words.add(new Words(syllables, code.toString(), candidate.toString()));
128134

129135
// Extra candidates
@@ -187,6 +193,11 @@ public String getComposingText(String aComposing, String aCode) {
187193
}
188194
}
189195
}
196+
// If we don't have a text code from the code book,
197+
// just return an empty string to do composing.
198+
if (aCode.isEmpty()) {
199+
return "";
200+
}
190201
return aComposing.replaceFirst(Pattern.quote(aCode), "");
191202
}
192203

0 commit comments

Comments
 (0)