aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-16 03:25:25 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-16 03:25:25 -0700
commita694c9ba08895dbfadd703acb731a383edad8c9f (patch)
tree027ea97e01deca7db3b804506c49726e89b9f9a9 /java/src/com/android/inputmethod/latin/RichInputConnection.java
parent7abeccfa2753806086c083b3ba7b5b96c40b387a (diff)
parentff766f8c4b92962440d5a11a914971bbf57d46c2 (diff)
downloadlatinime-a694c9ba08895dbfadd703acb731a383edad8c9f.tar.gz
latinime-a694c9ba08895dbfadd703acb731a383edad8c9f.tar.xz
latinime-a694c9ba08895dbfadd703acb731a383edad8c9f.zip
am ff766f8c: Merge "Don\'t insert automatic spaces when text looks like a URL"
* commit 'ff766f8c4b92962440d5a11a914971bbf57d46c2': Don't insert automatic spaces when text looks like a URL
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index e17846618..8ed7ab264 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -19,7 +19,6 @@ package com.android.inputmethod.latin;
import android.inputmethodservice.InputMethodService;
import android.text.SpannableString;
import android.text.TextUtils;
-import android.text.style.SuggestionSpan;
import android.util.Log;
import android.view.KeyEvent;
import android.view.inputmethod.CompletionInfo;
@@ -721,4 +720,15 @@ public final class RichInputConnection {
// position and the expected position, then it must be a belated update.
return (newSelStart - oldSelStart) * (mCurrentCursorPosition - newSelStart) >= 0;
}
+
+ /**
+ * Looks at the text just before the cursor to find out if it looks like a URL.
+ *
+ * The weakest point here is, if we don't have enough text bufferized, we may fail to realize
+ * we are in URL situation, but other places in this class have the same limitation and it
+ * does not matter too much in the practice.
+ */
+ public boolean textBeforeCursorLooksLikeURL() {
+ return StringUtils.lastPartLooksLikeURL(mCommittedTextBeforeComposingText);
+ }
}