diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java index 5ec1ec3e03f36..bd02d62b64f2d 100644 --- a/core/java/android/view/inputmethod/BaseInputConnection.java +++ b/core/java/android/view/inputmethod/BaseInputConnection.java @@ -193,10 +193,12 @@ public class BaseInputConnection implements InputConnection { /** * The default implementation performs the deletion around the current * selection position of the editable text. + * @param beforeLength + * @param afterLength */ - public boolean deleteSurroundingText(int leftLength, int rightLength) { - if (DEBUG) Log.v(TAG, "deleteSurroundingText " + leftLength - + " / " + rightLength); + public boolean deleteSurroundingText(int beforeLength, int afterLength) { + if (DEBUG) Log.v(TAG, "deleteSurroundingText " + beforeLength + + " / " + afterLength); final Editable content = getEditable(); if (content == null) return false; @@ -226,17 +228,17 @@ public class BaseInputConnection implements InputConnection { int deleted = 0; - if (leftLength > 0) { - int start = a - leftLength; + if (beforeLength > 0) { + int start = a - beforeLength; if (start < 0) start = 0; content.delete(start, a); deleted = a - start; } - if (rightLength > 0) { + if (afterLength > 0) { b = b - deleted; - int end = b + rightLength; + int end = b + afterLength; if (end > content.length()) end = content.length(); content.delete(b, end); diff --git a/core/java/android/view/inputmethod/InputConnection.java b/core/java/android/view/inputmethod/InputConnection.java index a6639d18511b5..bc2a270dcd7d7 100644 --- a/core/java/android/view/inputmethod/InputConnection.java +++ b/core/java/android/view/inputmethod/InputConnection.java @@ -138,19 +138,20 @@ public interface InputConnection { int flags); /** - * Delete leftLength characters of text before the current cursor - * position, and delete rightLength characters of text after the + * Delete beforeLength characters of text before the current cursor + * position, and delete afterLength characters of text after the * current cursor position, excluding composing text. * - * @param leftLength The number of characters to be deleted before the + * + * @param beforeLength The number of characters to be deleted before the * current cursor position. - * @param rightLength The number of characters to be deleted after the + * @param afterLength The number of characters to be deleted after the * current cursor position. - * + * * @return Returns true on success, false if the input connection is no longer * valid. */ - public boolean deleteSurroundingText(int leftLength, int rightLength); + public boolean deleteSurroundingText(int beforeLength, int afterLength); /** * Set composing text around the current cursor position with the given text, diff --git a/core/java/android/view/inputmethod/InputConnectionWrapper.java b/core/java/android/view/inputmethod/InputConnectionWrapper.java index 690ea85306b83..a48473e179322 100644 --- a/core/java/android/view/inputmethod/InputConnectionWrapper.java +++ b/core/java/android/view/inputmethod/InputConnectionWrapper.java @@ -62,8 +62,8 @@ public class InputConnectionWrapper implements InputConnection { return mTarget.getExtractedText(request, flags); } - public boolean deleteSurroundingText(int leftLength, int rightLength) { - return mTarget.deleteSurroundingText(leftLength, rightLength); + public boolean deleteSurroundingText(int beforeLength, int afterLength) { + return mTarget.deleteSurroundingText(beforeLength, afterLength); } public boolean setComposingText(CharSequence text, int newCursorPosition) { diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index e6fc3d6bdbd22..316634b6e7850 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -383,17 +383,17 @@ public class WebView extends AbsoluteLayout } @Override - public boolean deleteSurroundingText(int leftLength, int rightLength) { + public boolean deleteSurroundingText(int beforeLength, int afterLength) { // Look for one-character delete and send it as a key press. - if (leftLength == 1 && rightLength == 0) { + if (beforeLength == 1 && afterLength == 0) { sendKeyPress(KeyEvent.KEYCODE_DEL); - } else if (leftLength == 0 && rightLength == 1){ + } else if (beforeLength == 0 && afterLength == 1){ sendKeyPress(KeyEvent.KEYCODE_FORWARD_DEL); } else if (mWebViewCore != null) { mWebViewCore.sendMessage(EventHub.DELETE_SURROUNDING_TEXT, - leftLength, rightLength); + beforeLength, afterLength); } - return super.deleteSurroundingText(leftLength, rightLength); + return super.deleteSurroundingText(beforeLength, afterLength); } } diff --git a/core/java/com/android/internal/view/InputConnectionWrapper.java b/core/java/com/android/internal/view/InputConnectionWrapper.java index a235d9a2346f3..9024d8da37984 100644 --- a/core/java/com/android/internal/view/InputConnectionWrapper.java +++ b/core/java/com/android/internal/view/InputConnectionWrapper.java @@ -387,9 +387,9 @@ public class InputConnectionWrapper implements InputConnection { } } - public boolean deleteSurroundingText(int leftLength, int rightLength) { + public boolean deleteSurroundingText(int beforeLength, int afterLength) { try { - mIInputContext.deleteSurroundingText(leftLength, rightLength); + mIInputContext.deleteSurroundingText(beforeLength, afterLength); return true; } catch (RemoteException e) { return false;