aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-06-27 22:44:24 +0900
committerJean Chalard <jchalard@google.com>2014-07-01 15:01:22 +0900
commit292deb632cbab232334190e68d29184094d6d51b (patch)
tree8c9024d3ebe24575c16489b8a6c2c8f1d5e8ae1e /java/src/com/android/inputmethod/latin/RichInputConnection.java
parent943e91ffbd1edc88bcd815997f8b4d591d02dc7e (diff)
downloadlatinime-292deb632cbab232334190e68d29184094d6d51b.tar.gz
latinime-292deb632cbab232334190e68d29184094d6d51b.tar.xz
latinime-292deb632cbab232334190e68d29184094d6d51b.zip
[SD7] Actually check for script.
...also implement the check for Hebrew and Arabic. Bug: 15840116 Change-Id: Ia6433d7d98038ade64c171be4fe4b3f094111fac
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index 5e0dafa57..fdd47a40f 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -30,6 +30,7 @@ import com.android.inputmethod.latin.PrevWordsInfo.WordInfo;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
import com.android.inputmethod.latin.utils.CapsModeUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;
+import com.android.inputmethod.latin.utils.ScriptUtils;
import com.android.inputmethod.latin.utils.SpannableStringUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import com.android.inputmethod.latin.utils.TextRange;
@@ -623,9 +624,10 @@ public final class RichInputConnection {
* Returns the text surrounding the cursor.
*
* @param sortedSeparators a sorted array of code points that split words.
+ * @param scriptId the script we consider to be writing words, as one of ScriptUtils.SCRIPT_*
* @return a range containing the text surrounding the cursor
*/
- public TextRange getWordRangeAtCursor(final int[] sortedSeparators) {
+ public TextRange getWordRangeAtCursor(final int[] sortedSeparators, final int scriptId) {
mIC = mParent.getCurrentInputConnection();
if (mIC == null) {
return null;
@@ -642,7 +644,8 @@ public final class RichInputConnection {
int startIndexInBefore = before.length();
while (startIndexInBefore > 0) {
final int codePoint = Character.codePointBefore(before, startIndexInBefore);
- if (isSeparator(codePoint, sortedSeparators)) {
+ if (isSeparator(codePoint, sortedSeparators)
+ || !ScriptUtils.isLetterPartOfScript(codePoint, scriptId)) {
break;
}
--startIndexInBefore;
@@ -655,7 +658,8 @@ public final class RichInputConnection {
int endIndexInAfter = -1;
while (++endIndexInAfter < after.length()) {
final int codePoint = Character.codePointAt(after, endIndexInAfter);
- if (isSeparator(codePoint, sortedSeparators)) {
+ if (isSeparator(codePoint, sortedSeparators)
+ || !ScriptUtils.isLetterPartOfScript(codePoint, scriptId)) {
break;
}
if (Character.isSupplementaryCodePoint(codePoint)) {