@@ -339,7 +339,7 @@ static class InputMethodState {
339339
340340 private int mCursorDrawableRes ;
341341 private final Drawable [] mCursorDrawable = new Drawable [2 ];
342- private int mCursorCount ; // Actual current number of used mCursorDrawable: 0, 1 or 2
342+ private int mCursorCount ; // Actual current number of used mCursorDrawable: 0, 1 or 2 (split)
343343
344344 private Drawable mSelectHandleLeft ;
345345 private Drawable mSelectHandleRight ;
@@ -4322,7 +4322,7 @@ private void invalidateCursor(int a, int b, int c) {
43224322 if (a >= 0 || b >= 0 || c >= 0 ) {
43234323 int start = Math .min (Math .min (a , b ), c );
43244324 int end = Math .max (Math .max (a , b ), c );
4325- invalidateRegion (start , end );
4325+ invalidateRegion (start , end , true /* Also invalidates blinking cursor */ );
43264326 }
43274327 }
43284328
@@ -4331,7 +4331,7 @@ private void invalidateCursor(int a, int b, int c) {
43314331 *
43324332 * @hide
43334333 */
4334- void invalidateRegion (int start , int end ) {
4334+ void invalidateRegion (int start , int end , boolean invalidateCursor ) {
43354335 if (mLayout == null ) {
43364336 invalidate ();
43374337 } else {
@@ -4357,11 +4357,19 @@ void invalidateRegion(int start, int end) {
43574357
43584358 int bottom = mLayout .getLineBottom (lineEnd );
43594359
4360+ if (invalidateCursor ) {
4361+ for (int i = 0 ; i < mCursorCount ; i ++) {
4362+ Rect bounds = mCursorDrawable [i ].getBounds ();
4363+ top = Math .min (top , bounds .top );
4364+ bottom = Math .max (bottom , bounds .bottom );
4365+ }
4366+ }
4367+
43604368 final int compoundPaddingLeft = getCompoundPaddingLeft ();
43614369 final int verticalPadding = getExtendedPaddingTop () + getVerticalOffset (true );
43624370
43634371 int left , right ;
4364- if (lineStart == lineEnd ) {
4372+ if (lineStart == lineEnd && ! invalidateCursor ) {
43654373 left = (int ) mLayout .getPrimaryHorizontal (start );
43664374 right = (int ) (mLayout .getPrimaryHorizontal (end ) + 1.0 );
43674375 left += compoundPaddingLeft ;
0 commit comments