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

Commit

Permalink
Fixed using backslashes crash in Java 1.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
daoshengmu committed Mar 26, 2020
1 parent b06ac39 commit d591891
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ public CandidatesResult getCandidates(String aComposingText) {
}

// Autocomplete when special characters are clicked
final char BACKSLASH_CODE = 92;
char lastChar = aComposingText.charAt(aComposingText.length() - 1);

// When using backslashes ({@code \}) in the replacement string
// will cause crash at `replaceFirst()`, so we need to replace it first.
if (lastChar == BACKSLASH_CODE) {
aComposingText = aComposingText.replace("\\", "\\\\");
}
boolean autocomponse = mAutocompleteEndings.indexOf(lastChar) >= 0;

aComposingText = aComposingText.replaceAll("\\s","");
Expand Down

0 comments on commit d591891

Please sign in to comment.