Revert "Fix a race condition."

This reverts commit 42e83c7f06a1683b27a11564aeb9f3999b10382f.

Bug: 12434783
Change-Id: Id01b6d14906430b13e64f5fc4d7fb01572d0a960
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index c867ab3..b365003 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1113,11 +1113,8 @@
                 keyboardSwitcher.getKeyboard());
         mWordComposer.setCursorPositionWithinWord(
                 typedWord.codePointCount(0, numberOfCharsInWordBeforeCursor));
-        // TODO: Change these two lines to setComposingRegion(cursorPosition,
-        //         cursorPosition + range.getNumberOfCharsInWordAfterCursor());
-        mConnection.deleteSurroundingText(numberOfCharsInWordBeforeCursor,
-              typedWord.length() - numberOfCharsInWordBeforeCursor);
-        mConnection.setComposingText(typedWord, 1);
+        mConnection.setComposingRegion(expectedCursorPosition - numberOfCharsInWordBeforeCursor,
+                expectedCursorPosition + range.getNumberOfCharsInWordAfterCursor());
         if (suggestions.isEmpty()) {
             // We come here if there weren't any suggestion spans on this word. We will try to
             // compute suggestions for it instead.