Skip to content

Commit 775e986

Browse files
jreckAndroid (Google) Code Review
authored andcommitted
Merge "Fix add single character check" into ics-mr1
2 parents 1da3d65 + f9a6c91 commit 775e986

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/java/android/webkit/WebTextView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ protected void onTextChanged(CharSequence s,int start,int before,int count){
567567
mPreChange.substring(0, mMaxLength).equals(postChange))) {
568568
return;
569569
}
570-
mPreChange = postChange;
571570
if (0 == count) {
572571
if (before > 0) {
573572
// For this and all changes to the text, update our cache
@@ -605,9 +604,9 @@ protected void onTextChanged(CharSequence s,int start,int before,int count){
605604
// Prefer sending javascript events, so when adding one character,
606605
// don't replace the unchanged text.
607606
if (count > 1 && before == count - 1) {
608-
String replaceButOne = s.subSequence(start,
607+
String replaceButOne = mPreChange.subSequence(start,
609608
start + before).toString();
610-
String replacedString = getText().subSequence(start,
609+
String replacedString = s.subSequence(start,
611610
start + before).toString();
612611
if (replaceButOne.equals(replacedString)) {
613612
// we're just adding one character
@@ -616,6 +615,7 @@ protected void onTextChanged(CharSequence s,int start,int before,int count){
616615
count = 1;
617616
}
618617
}
618+
mPreChange = postChange;
619619
// Find the last character being replaced. If it can be represented by
620620
// events, we will pass them to native so we can see javascript events.
621621
// Otherwise, replace the text being changed in the textfield.

0 commit comments

Comments
 (0)