am 84c4b08b: Merge changes Ia5729aaf,I91584b7d into jb-dev

* commit '84c4b08bd424151f3fa84029b55573022562fd23':
  Remove selection highlight when replacing/deleting.
  Don't do character add/delete when there is a selection.
This commit is contained in:
George Mount
2012-05-17 09:07:57 -07:00
committed by Android Git Automerger

View File

@@ -431,14 +431,18 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
boolean isCharacterDelete = false;
int textLength = text.length();
int originalLength = original.length();
if (textLength > originalLength) {
isCharacterAdd = (textLength == originalLength + 1)
&& TextUtils.regionMatches(text, 0, original, 0,
originalLength);
} else if (originalLength > textLength) {
isCharacterDelete = (textLength == originalLength - 1)
&& TextUtils.regionMatches(text, 0, original, 0,
textLength);
int selectionStart = Selection.getSelectionStart(editable);
int selectionEnd = Selection.getSelectionEnd(editable);
if (selectionStart == selectionEnd) {
if (textLength > originalLength) {
isCharacterAdd = (textLength == originalLength + 1)
&& TextUtils.regionMatches(text, 0, original, 0,
originalLength);
} else if (originalLength > textLength) {
isCharacterDelete = (textLength == originalLength - 1)
&& TextUtils.regionMatches(text, 0, original, 0,
textLength);
}
}
if (isCharacterAdd) {
sendCharacter(text.charAt(textLength - 1));
@@ -7481,6 +7485,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
int cursorPosition = start + text.length();
replaceTextfieldText(start, end, text,
cursorPosition, cursorPosition);
selectionDone();
break;
}