Fix for 2466885 : Key prediction is spilling over to next word.
diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index e08af1a..0757f1b 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -1439,6 +1439,8 @@
             TextEntryState.acceptedDefault(mWord.getTypedWord(), mBestWord);
             mJustAccepted = true;
             pickSuggestion(mBestWord);
+            // Add the word to the auto dictionary if it's not a known word
+            checkAddToDictionary(mBestWord, AutoDictionary.FREQUENCY_FOR_TYPED);
         }
     }
 
@@ -1476,6 +1478,8 @@
         }
         mJustAccepted = true;
         pickSuggestion(suggestion);
+        // Add the word to the auto dictionary if it's not a known word
+        checkAddToDictionary(suggestion, AutoDictionary.FREQUENCY_FOR_PICKED);
         TextEntryState.acceptedSuggestion(mComposing.toString(), suggestion);
         // Follow it with a space
         if (mAutoSpace) {
@@ -1509,10 +1513,9 @@
                 ic.commitText(suggestion, 1);
             }
         }
-        // Add the word to the auto dictionary if it's not a known word
-        checkAddToDictionary(suggestion, AutoDictionary.FREQUENCY_FOR_PICKED);
         mPredicting = false;
         mCommittedLength = suggestion.length();
+        ((LatinKeyboard) mInputView.getKeyboard()).setPreferredLetters(null);
         setNextSuggestions();
         updateShiftKeyState(getCurrentInputEditorInfo());
     }