From 38d31a5e79c64e706e1698d2d24adb51c4ac53aa Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Mon, 10 Feb 2014 23:07:00 +0900
Subject: [PATCH] Display predictions when the cursor is moved after a word.

Bug: 12951777
Change-Id: I744b98df6679edd34ca3c1392e38597325935932
---
 .../android/inputmethod/latin/inputlogic/InputLogic.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 6e9050593d..db0b7418b1 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1256,7 +1256,14 @@ public final class InputLogic {
         // If we don't know the cursor location, return.
         if (mConnection.getExpectedSelectionStart() < 0) return;
         final int expectedCursorPosition = mConnection.getExpectedSelectionStart();
-        if (!mConnection.isCursorTouchingWord(settingsValues.mSpacingAndPunctuations)) return;
+        if (!mConnection.isCursorTouchingWord(settingsValues.mSpacingAndPunctuations)) {
+            // Show predictions.
+            mWordComposer.setCapitalizedModeAndPreviousWordAtStartComposingTime(
+                    WordComposer.CAPS_MODE_OFF,
+                    getNthPreviousWordForSuggestion(settingsValues.mSpacingAndPunctuations, 1));
+            mLatinIME.mHandler.postUpdateSuggestionStrip();
+            return;
+        }
         final TextRange range = mConnection.getWordRangeAtCursor(
                 settingsValues.mSpacingAndPunctuations.mSortedWordSeparators,
                 0 /* additionalPrecedingWordsCount */);
-- 
GitLab