aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-17 19:47:35 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-17 19:47:35 -0700
commit38d52c0acad3d0dd909b4dc027294f58870c438e (patch)
tree93fa79f436299298038d7e4154075b1bb11cd3d1 /java/src/com/android/inputmethod/latin/RichInputConnection.java
parent38046a0a4ee4a89b6966ad3416a85117b56893d6 (diff)
parenta694c9ba08895dbfadd703acb731a383edad8c9f (diff)
downloadlatinime-38d52c0acad3d0dd909b4dc027294f58870c438e.tar.gz
latinime-38d52c0acad3d0dd909b4dc027294f58870c438e.tar.xz
latinime-38d52c0acad3d0dd909b4dc027294f58870c438e.zip
am a694c9ba: am ff766f8c: Merge "Don\'t insert automatic spaces when text looks like a URL"
* commit 'a694c9ba08895dbfadd703acb731a383edad8c9f': 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);
+ }
}