@@ -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