Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Unified Diff: components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java

Issue 2943033002: Remove zero-length spaces from Android spelling suggestions (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
diff --git a/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java b/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
index b2ce3297cc22dd808207b23875910336a55a7a82..25728da96eeca57a9b9289c4577d17b1ebd2acc8 100644
--- a/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
+++ b/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
@@ -125,7 +125,12 @@ public class SpellCheckerSessionBridge implements SpellCheckerSessionListener {
SuggestionsInfo info = result.getSuggestionsInfoAt(i);
ArrayList<String> suggestions_for_word = new ArrayList<String>();
for (int j = 0; j < info.getSuggestionsCount(); ++j) {
- suggestions_for_word.add(info.getSuggestionAt(j));
+ String suggestion = info.getSuggestionAt(j);
+ // Remove zero-length space from end of suggestion, if any
+ if (suggestion.charAt(suggestion.length() - 1) == 0x200b) {
timvolodine 2017/06/16 15:25:37 Can the suggestion be zero-length? (i.e. such that
+ suggestion = suggestion.substring(0, suggestion.length() - 1);
+ }
+ suggestions_for_word.add(suggestion);
}
suggestions.add(
suggestions_for_word.toArray(new String[suggestions_for_word.size()]));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698