diff options
author | 2013-06-21 15:59:06 +0900 | |
---|---|---|
committer | 2013-06-21 18:15:07 +0900 | |
commit | e5dee0af4ae991988919b2c5b80c10a94b26884e (patch) | |
tree | 10726ca82fb71ef9751d0de86875470e6b41dfbb /java/src/com/android/inputmethod/latin/RichInputConnection.java | |
parent | 0c178ffc8e21467890fcc2433cf27108c090e6fc (diff) | |
download | latinime-e5dee0af4ae991988919b2c5b80c10a94b26884e.tar.gz latinime-e5dee0af4ae991988919b2c5b80c10a94b26884e.tar.xz latinime-e5dee0af4ae991988919b2c5b80c10a94b26884e.zip |
Fix a bug in the cached cursor pos, and simplify selection handling
The documentation for setComposingRegion states explicitly
that it does not move the cursor. This is just a bug.
This does not have any ill effects right now, but it will have
in later changes if not fixed.
As for the selection handling, the specific test that this code
removes used to serve a purpose, but it does not any more because
the code using the value has been much sanitized. Now the variable
can just take the obvious value, and become so self-explanatory
that the comments are unnecessary.
Change-Id: I548d899b38776bd3ab5f5361aab0d89d98f12e73
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/RichInputConnection.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 980215de6..6226f9b21 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -338,7 +338,6 @@ public final class RichInputConnection { public void setComposingRegion(final int start, final int end) { if (DEBUG_BATCH_NESTING) checkBatchEdit(); if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); - mCurrentCursorPosition = end; final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE + (end - start), 0); mCommittedTextBeforeComposingText.setLength(0); @@ -723,6 +722,14 @@ public final class RichInputConnection { } /** + * The user moved the cursor by hand. Take a note of it. + * @param newCursorPosition The new cursor position. + */ + public void userMovedCursor(final int newCursorPosition) { + mCurrentCursorPosition = newCursorPosition; + } + + /** * Looks at the text just before the cursor to find out if it looks like a URL. * * The weakest point here is, if we don't have enough text bufferized, we may fail to realize |