aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-07-01 07:46:19 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-07-01 07:46:19 +0000
commit64a792db2e9da62ac87053c982272ae820c80244 (patch)
tree816394321d6a38f8ddcebb330db7af14968c89a3 /java/src/com/android/inputmethod/latin/RichInputConnection.java
parentdca55d7c972d3753078d18d8a611470c239a94b4 (diff)
parent292deb632cbab232334190e68d29184094d6d51b (diff)
downloadlatinime-64a792db2e9da62ac87053c982272ae820c80244.tar.gz
latinime-64a792db2e9da62ac87053c982272ae820c80244.tar.xz
latinime-64a792db2e9da62ac87053c982272ae820c80244.zip
am 292deb63: [SD7] Actually check for script.
* commit '292deb632cbab232334190e68d29184094d6d51b': [SD7] Actually check for script.
Diffstat (limited to '')
-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)) {