diff options
author | 2014-01-09 14:09:26 +0900 | |
---|---|---|
committer | 2014-01-10 19:08:47 +0900 | |
commit | a224aafea36a80f6727aa7ed93fe87091f01d585 (patch) | |
tree | 6581ce7403b164713f31febfbef8c7ee9b25cee6 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | ecf46df22683b997311ba77b34b33dffa8be43c0 (diff) | |
download | latinime-a224aafea36a80f6727aa7ed93fe87091f01d585.tar.gz latinime-a224aafea36a80f6727aa7ed93fe87091f01d585.tar.xz latinime-a224aafea36a80f6727aa7ed93fe87091f01d585.zip |
[IL54.5] Use the cursor pos estimate, not the last value
For edit tasks, the estimate is actually the right thing to use.
This is really dangerous, but it will get rid of pretty much all
race conditions.
Change-Id: I2d5ca3ce45e32f1bd9c8b778421fd54b9c1f6f63
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 3984c197a..c9602bcc4 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -880,8 +880,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Notify ResearchLogger if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_onFinishInputViewInternal(finishingInput, - mInputLogic.mLastSelectionStart, - mInputLogic.mLastSelectionEnd, getCurrentInputConnection()); + // TODO[IL]: mInputLogic.mConnection should be private + mInputLogic.mConnection.getExpectedSelectionStart(), + mInputLogic.mConnection.getExpectedSelectionEnd(), getCurrentInputConnection()); } } @@ -894,22 +895,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (DEBUG) { Log.i(TAG, "onUpdateSelection: oss=" + oldSelStart + ", ose=" + oldSelEnd - + ", lss=" + mInputLogic.mLastSelectionStart - + ", lse=" + mInputLogic.mLastSelectionEnd + ", nss=" + newSelStart + ", nse=" + newSelEnd + ", cs=" + composingSpanStart + ", ce=" + composingSpanEnd); } if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { - ResearchLogger.latinIME_onUpdateSelection(mInputLogic.mLastSelectionStart, - mInputLogic.mLastSelectionEnd, + ResearchLogger.latinIME_onUpdateSelection(oldSelStart, oldSelEnd, oldSelStart, oldSelEnd, newSelStart, newSelEnd, composingSpanStart, composingSpanEnd, mInputLogic.mConnection); } - final boolean selectionChanged = mInputLogic.mLastSelectionStart != newSelStart - || mInputLogic.mLastSelectionEnd != newSelEnd; + final boolean selectionChanged = oldSelStart != newSelStart || oldSelEnd != newSelEnd; // if composingSpanStart and composingSpanEnd are -1, it means there is no composing // span in the view - we can use that to narrow down whether the cursor was moved @@ -972,9 +969,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mKeyboardSwitcher.updateShiftState(); } - // Make a note of the cursor position - mInputLogic.mLastSelectionStart = newSelStart; - mInputLogic.mLastSelectionEnd = newSelEnd; mSubtypeState.currentSubtypeUsed(); } |