aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-06-26 12:22:04 +0900
committerJean Chalard <jchalard@google.com>2013-06-26 16:03:40 +0900
commitfb72890ac6cea2b39a0dbd401ebee6b42323e5f3 (patch)
treeaa55078c33166681765b5fa61ea5d05570061b03 /java
parent7fcf304c974d52a816b3375f22e714798fe308e5 (diff)
downloadlatinime-fb72890ac6cea2b39a0dbd401ebee6b42323e5f3.tar.gz
latinime-fb72890ac6cea2b39a0dbd401ebee6b42323e5f3.tar.xz
latinime-fb72890ac6cea2b39a0dbd401ebee6b42323e5f3.zip
Readability improvement
Change-Id: I2f350145f333ba1fa4eb20027b0f41107c2df02c
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 9ef273918..c867436e5 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -928,14 +928,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final boolean selectionChanged = mLastSelectionStart != newSelStart
|| mLastSelectionEnd != 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
// by us or not. If we are composing a word but there is no composing span, then
// we know for sure the cursor moved while we were composing and we should reset
// the state. TODO: rescind this policy: the framework never removes the composing
// span on its own accord while editing. This test is useless.
-
final boolean noComposingSpan = composingSpanStart == -1 && composingSpanEnd == -1;
+
// If the keyboard is not visible, we don't need to do all the housekeeping work, as it
// will be reset when the keyboard shows up anyway.
// TODO: revisit this when LatinIME supports hardware keyboards.
@@ -957,7 +958,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// state-related special processing to kick in.
mSpaceState = SPACE_STATE_NONE;
- if ((!mWordComposer.isComposingWord()) || selectionChanged || noComposingSpan) {
+ // TODO: is it still necessary to test for composingSpan related stuff?
+ final boolean selectionChangedOrSafeToReset = selectionChanged
+ || (!mWordComposer.isComposingWord()) || noComposingSpan;
+ if (selectionChangedOrSafeToReset) {
// If we are composing a word and moving the cursor, we would want to set a
// suggestion span for recorrection to work correctly. Unfortunately, that
// would involve the keyboard committing some new text, which would move the