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

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

Merge "Add a relevant suggestion to period-checkable requests"

parents 3698facb e530fffc
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -220,6 +220,7 @@ public final class Constants {


    public static final String REGEXP_PERIOD = "\\.";
    public static final String REGEXP_PERIOD = "\\.";
    public static final String STRING_SPACE = " ";
    public static final String STRING_SPACE = " ";
    public static final String STRING_PERIOD_AND_SPACE = ". ";


    /**
    /**
     * Special keys code. Must be negative.
     * Special keys code. Must be negative.
+2 −3
Original line number Original line Diff line number Diff line
@@ -741,13 +741,12 @@ public final class RichInputConnection {
        // Here we test whether we indeed have a period and a space before us. This should not
        // Here we test whether we indeed have a period and a space before us. This should not
        // be needed, but it's there just in case something went wrong.
        // be needed, but it's there just in case something went wrong.
        final CharSequence textBeforeCursor = getTextBeforeCursor(2, 0);
        final CharSequence textBeforeCursor = getTextBeforeCursor(2, 0);
        final String periodSpace = ". ";
        if (!TextUtils.equals(Constants.STRING_PERIOD_AND_SPACE, textBeforeCursor)) {
        if (!TextUtils.equals(periodSpace, textBeforeCursor)) {
            // Theoretically we should not be coming here if there isn't ". " before the
            // Theoretically we should not be coming here if there isn't ". " before the
            // cursor, but the application may be changing the text while we are typing, so
            // cursor, but the application may be changing the text while we are typing, so
            // anything goes. We should not crash.
            // anything goes. We should not crash.
            Log.d(TAG, "Tried to revert double-space combo but we didn't find "
            Log.d(TAG, "Tried to revert double-space combo but we didn't find "
                    + "\"" + periodSpace + "\" just before the cursor.");
                    + "\"" + Constants.STRING_PERIOD_AND_SPACE + "\" just before the cursor.");
            return false;
            return false;
        }
        }
        // Double-space results in ". ". A backspace to cancel this should result in a single
        // Double-space results in ". ". A backspace to cancel this should result in a single
+3 −1
Original line number Original line Diff line number Diff line
@@ -258,7 +258,9 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
                            return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO
                            return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO
                                    | SuggestionsInfo.RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS,
                                    | SuggestionsInfo.RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS,
                                    new String[] {
                                    new String[] {
                                            TextUtils.join(Constants.STRING_SPACE, splitText) });
                                            TextUtils.join(Constants.STRING_SPACE, splitText),
                                            TextUtils.join(Constants.STRING_PERIOD_AND_SPACE,
                                                    splitText) });
                        }
                        }
                    }
                    }
                    return dictInfo.mDictionary.isValidWord(inText)
                    return dictInfo.mDictionary.isValidWord(inText)