aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-02-17 11:46:54 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-17 11:46:54 +0000
commit782c9fee6bcb32d67c8ee9faa7e5c9dfb091afd3 (patch)
treede2d31c24e235611dc1b1677fc46638b3afd9b8b /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parentd91cd9919e309e72f912f5cb135792351d7081ac (diff)
parent7a7aeffcdcf1f25abdc3923e81fa19c2258fa9e9 (diff)
downloadlatinime-782c9fee6bcb32d67c8ee9faa7e5c9dfb091afd3.tar.gz
latinime-782c9fee6bcb32d67c8ee9faa7e5c9dfb091afd3.tar.xz
latinime-782c9fee6bcb32d67c8ee9faa7e5c9dfb091afd3.zip
Merge "Don't resume suggestion on links."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 6f73859e8..9bf9d1f45 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1270,6 +1270,10 @@ public final class InputLogic {
if (range.length() <= 0) return; // Race condition. No text to resume on, so bail out.
// If for some strange reason (editor bug or so) we measure the text before the cursor as
// longer than what the entire text is supposed to be, the safe thing to do is bail out.
+ if (range.mHasUrlSpans) return; // If there are links, we don't resume suggestions. Making
+ // edits to a linkified text through batch commands would ruin the URL spans, and unless
+ // we take very complicated steps to preserve the whole link, we can't do things right so
+ // we just do not resume because it's safer.
final int numberOfCharsInWordBeforeCursor = range.getNumberOfCharsInWordBeforeCursor();
if (numberOfCharsInWordBeforeCursor > expectedCursorPosition) return;
final ArrayList<SuggestedWordInfo> suggestions = CollectionUtils.newArrayList();