Merge "Fix dead key -> space combination." into jb-mr2-dev
This commit is contained in:
@@ -180,6 +180,7 @@ public class QwertyKeyListener extends BaseKeyListener {
|
||||
if (composed != 0) {
|
||||
i = composed;
|
||||
replace = true;
|
||||
dead = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +180,8 @@ public class KeyCharacterMap implements Parcelable {
|
||||
private static final int ACCENT_CIRCUMFLEX_LEGACY = '^';
|
||||
private static final int ACCENT_TILDE_LEGACY = '~';
|
||||
|
||||
private static final int CHAR_SPACE = ' ';
|
||||
|
||||
/**
|
||||
* Maps Unicode combining diacritical to display-form dead key.
|
||||
*/
|
||||
@@ -473,14 +475,23 @@ public class KeyCharacterMap implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the character that is produced by putting accent on the character c.
|
||||
* Get the character that is produced by combining the dead key producing accent
|
||||
* with the key producing character c.
|
||||
* For example, getDeadChar('`', 'e') returns è.
|
||||
* getDeadChar('^', ' ') returns '^' and getDeadChar('^', '^') returns '^'.
|
||||
*
|
||||
* @param accent The accent character. eg. '`'
|
||||
* @param c The basic character.
|
||||
* @return The combined character, or 0 if the characters cannot be combined.
|
||||
*/
|
||||
public static int getDeadChar(int accent, int c) {
|
||||
if (c == accent || CHAR_SPACE == c) {
|
||||
// The same dead character typed twice or a dead character followed by a
|
||||
// space should both produce the non-combining version of the combining char.
|
||||
// In this case we don't even need to compute the combining character.
|
||||
return accent;
|
||||
}
|
||||
|
||||
int combining = sAccentToCombining.get(accent);
|
||||
if (combining == 0) {
|
||||
return 0;
|
||||
@@ -495,7 +506,8 @@ public class KeyCharacterMap implements Parcelable {
|
||||
sDeadKeyBuilder.append((char)c);
|
||||
sDeadKeyBuilder.append((char)combining);
|
||||
String result = Normalizer.normalize(sDeadKeyBuilder, Normalizer.Form.NFC);
|
||||
combined = result.length() == 1 ? result.charAt(0) : 0;
|
||||
combined = result.codePointCount(0, result.length()) == 1
|
||||
? result.codePointAt(0) : 0;
|
||||
sDeadKeyCache.put(combination, combined);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user