aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2011-07-25 15:59:18 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-25 15:59:18 -0700
commite9d74adcc83e1a9fdc3055c08385c6323d22632f (patch)
treee0bd6f3e7fed2f4578f56a489ecb4474d2b7a5a1 /java/src
parent71ffd74f05b52a44ad07201564fbc3c909fd6af7 (diff)
parent83ffff2a49beeb41874b7cb40819a75001f708e2 (diff)
downloadlatinime-e9d74adcc83e1a9fdc3055c08385c6323d22632f.tar.gz
latinime-e9d74adcc83e1a9fdc3055c08385c6323d22632f.tar.xz
latinime-e9d74adcc83e1a9fdc3055c08385c6323d22632f.zip
Merge "Take care of bidi-mirrored characters in suggestion strip as well"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java2
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java8
2 files changed, 8 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 3b6343d19..0ee8d7174 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -181,7 +181,7 @@ public class Key {
sRtlParenthesisMap.put(right, left);
}
- private static int getRtlParenthesisCode(int code) {
+ public static int getRtlParenthesisCode(int code) {
if (sRtlParenthesisMap.containsKey(code)) {
return sRtlParenthesisMap.get(code);
} else {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 3457ac984..a8118e549 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -60,6 +60,7 @@ import com.android.inputmethod.compat.SuggestionSpanUtils;
import com.android.inputmethod.deprecated.LanguageSwitcherProxy;
import com.android.inputmethod.deprecated.VoiceProxy;
import com.android.inputmethod.deprecated.recorrection.Recorrection;
+import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
@@ -1695,7 +1696,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// for punctuation entered through the suggestion strip, it should be considered
// a magic space even if it was a normal space. This is meant to help in case the user
// pressed space on purpose of displaying the suggestion strip punctuation.
- final char primaryCode = suggestion.charAt(0);
+ final int rawPrimaryCode = suggestion.charAt(0);
+ // Maybe apply the "bidi mirrored" conversions for parentheses
+ final LatinKeyboard keyboard = mKeyboardSwitcher.getLatinKeyboard();
+ final int primaryCode = keyboard.isRtlKeyboard()
+ ? Key.getRtlParenthesisCode(rawPrimaryCode) : rawPrimaryCode;
+
final CharSequence beforeText = ic != null ? ic.getTextBeforeCursor(1, 0) : "";
final int toLeft = (ic == null || TextUtils.isEmpty(beforeText))
? 0 : beforeText.charAt(0);