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

Commit 0dd23544 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Very simple refactoring"

parents ffcbbaf1 f712dc9a
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -139,13 +139,17 @@ public final class RichInputConnection {
        if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
    }

    public void resetCachesUponCursorMove(final int newCursorPosition,
            final boolean shouldFinishComposition) {
        mCurrentCursorPosition = newCursorPosition;
    private void refreshCache() {
        mComposingText.setLength(0);
        mCommittedTextBeforeComposingText.setLength(0);
        final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0);
        if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor);
    }

    public void resetCachesUponCursorMove(final int newCursorPosition,
            final boolean shouldFinishComposition) {
        mCurrentCursorPosition = newCursorPosition;
        refreshCache();
        if (null != mIC && shouldFinishComposition) {
            mIC.finishComposingText();
            if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {