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

Commit 0730bbfb authored by Jean Chalard's avatar Jean Chalard
Browse files

Straighten out magic space vs real spaces behavior.

Picking a suggestion inserts a space after the word. This change makes
this space a magic space.

Incidentally, do some minor cleanup: add CODE_DASH, CODE_SINGLE_QUOTE
and CODE_DOUBLE_QUOTE to Keyboard and use them throughout the code,
and remove a useless import directive in some unrelated file.

Bug: 4319740

Change-Id: I245f396c34dd0af820bca91edc4ec363238a4ae4
parent 3bf6fbb6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@
    <integer name="key_tab">9</integer>
    <integer name="key_return">10</integer>
    <integer name="key_space">32</integer>
    <integer name="key_dash">45</integer>
    <integer name="key_single_quote">39</integer>
    <integer name="key_double_quote">34</integer>
    <integer name="key_shift">-1</integer>
    <integer name="key_switch_alpha_symbol">-2</integer>
    <integer name="key_delete">-5</integer>
+3 −0
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ public class Keyboard {
    public static final int CODE_TAB = '\t';
    public static final int CODE_SPACE = ' ';
    public static final int CODE_PERIOD = '.';
    public static final int CODE_DASH = '-';
    public static final int CODE_SINGLE_QUOTE = '\'';
    public static final int CODE_DOUBLE_QUOTE = '"';

    /** Special keys code.  These should be aligned with values/keycodes.xml */
    public static final int CODE_DUMMY = 0;
+1 −1
Original line number Diff line number Diff line
@@ -626,7 +626,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha

    private static boolean isQuoteCharacter(int c) {
        // Apostrophe, quotation mark.
        if (c == '\'' || c == '"')
        if (c == Keyboard.CODE_SINGLE_QUOTE || c == Keyboard.CODE_DOUBLE_QUOTE)
            return true;
        // \u2018: Left single quotation mark
        // \u2019: Right single quotation mark
+5 −2
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.provider.ContactsContract.Contacts;
import android.text.TextUtils;
import android.util.Log;

import com.android.inputmethod.keyboard.Keyboard;

public class ContactsDictionary extends ExpandableDictionary {

    private static final String[] PROJECTION = {
@@ -123,8 +125,9 @@ public class ContactsDictionary extends ExpandableDictionary {
                                for (j = i + 1; j < len; j++) {
                                    char c = name.charAt(j);

                                    if (!(c == '-' || c == '\'' ||
                                          Character.isLetter(c))) {
                                    if (!(c == Keyboard.CODE_DASH
                                            || c == Keyboard.CODE_SINGLE_QUOTE
                                            || Character.isLetter(c))) {
                                        break;
                                    }
                                }
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.inputmethod.latin;

import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.util.Log;

Loading