Skip to content

Commit ba25c01

Browse files
Gilles DebunneAndroid (Google) Code Review
authored andcommitted
Merge "Bug 5237623: word no longer underlined after replacement"
2 parents cde59f2 + 5915c88 commit ba25c01

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

core/java/android/widget/SpellChecker.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ private void createMisspelledSuggestionSpan(Editable editable,
249249
final int spanEnd = editable.getSpanEnd(suggestionSpans[i]);
250250
if (spanStart != start || spanEnd != end) {
251251
suggestionSpans[i] = null;
252-
break;
253252
}
254253
}
255254

core/java/android/widget/TextView.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9607,15 +9607,6 @@ private class SuggestionInfo {
96079607
SpannableStringBuilder text = new SpannableStringBuilder();
96089608
TextAppearanceSpan highlightSpan = new TextAppearanceSpan(mContext,
96099609
android.R.style.TextAppearance_SuggestionHighlight);
9610-
9611-
void removeMisspelledFlag() {
9612-
int suggestionSpanFlags = suggestionSpan.getFlags();
9613-
if ((suggestionSpanFlags & SuggestionSpan.FLAG_MISSPELLED) > 0) {
9614-
suggestionSpanFlags &= ~SuggestionSpan.FLAG_MISSPELLED;
9615-
suggestionSpanFlags &= ~SuggestionSpan.FLAG_EASY_CORRECT;
9616-
suggestionSpan.setFlags(suggestionSpanFlags);
9617-
}
9618-
}
96199610
}
96209611

96219612
private class SuggestionAdapter extends BaseAdapter {
@@ -9931,6 +9922,14 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
99319922
suggestionSpansStarts[i] = editable.getSpanStart(suggestionSpan);
99329923
suggestionSpansEnds[i] = editable.getSpanEnd(suggestionSpan);
99339924
suggestionSpansFlags[i] = editable.getSpanFlags(suggestionSpan);
9925+
9926+
// Remove potential misspelled flags
9927+
int suggestionSpanFlags = suggestionSpan.getFlags();
9928+
if ((suggestionSpanFlags & SuggestionSpan.FLAG_MISSPELLED) > 0) {
9929+
suggestionSpanFlags &= ~SuggestionSpan.FLAG_MISSPELLED;
9930+
suggestionSpanFlags &= ~SuggestionSpan.FLAG_EASY_CORRECT;
9931+
suggestionSpan.setFlags(suggestionSpanFlags);
9932+
}
99349933
}
99359934

99369935
final int suggestionStart = suggestionInfo.suggestionStart;
@@ -9939,8 +9938,6 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
99399938
suggestionStart, suggestionEnd).toString();
99409939
editable.replace(spanStart, spanEnd, suggestion);
99419940

9942-
suggestionInfo.removeMisspelledFlag();
9943-
99449941
// Notify source IME of the suggestion pick. Do this before swaping texts.
99459942
if (!TextUtils.isEmpty(
99469943
suggestionInfo.suggestionSpan.getNotificationTargetClassName())) {

0 commit comments

Comments
 (0)