Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42e83c7f authored by Jean Chalard's avatar Jean Chalard
Browse files

Fix a race condition.

Don't use absolute cursor positions, this leads to race
conditions.

Bug: 12390573
Change-Id: I6f04f07a46babbc3d51cb94c7eaee21bed242396
parent 6d5f9fd3
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1113,8 +1113,11 @@ public final class InputLogic {
                keyboardSwitcher.getKeyboard());
        mWordComposer.setCursorPositionWithinWord(
                typedWord.codePointCount(0, numberOfCharsInWordBeforeCursor));
        mConnection.setComposingRegion(expectedCursorPosition - numberOfCharsInWordBeforeCursor,
                expectedCursorPosition + range.getNumberOfCharsInWordAfterCursor());
        // TODO: Change these two lines to setComposingRegion(cursorPosition,
        //         cursorPosition + range.getNumberOfCharsInWordAfterCursor());
        mConnection.deleteSurroundingText(numberOfCharsInWordBeforeCursor,
              typedWord.length() - numberOfCharsInWordBeforeCursor);
        mConnection.setComposingText(typedWord, 1);
        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.