diff options
author | 2014-07-01 03:26:39 +0000 | |
---|---|---|
committer | 2014-07-01 03:26:39 +0000 | |
commit | f75abd67a34d25b71fc797cff870abb8519c360f (patch) | |
tree | 9772b8e4b6e8ef6b84f6f36b4559a8356376b0f7 /java | |
parent | ce612a06893da7f027b4546c0d05530dee4e5acf (diff) | |
parent | 87d907bda94a05e4ea503ae2a269eb444c10ae35 (diff) | |
download | latinime-f75abd67a34d25b71fc797cff870abb8519c360f.tar.gz latinime-f75abd67a34d25b71fc797cff870abb8519c360f.tar.xz latinime-f75abd67a34d25b71fc797cff870abb8519c360f.zip |
am 87d907bd: Merge "Revert "[SD5] Remove useless args""
* commit '87d907bda94a05e4ea503ae2a269eb444c10ae35':
Revert "[SD5] Remove useless args"
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/RichInputConnection.java | 18 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 3 |
2 files changed, 18 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 96bf17b5c..62b55bca1 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -620,13 +620,27 @@ public final class RichInputConnection { } /** + * @param sortedSeparators a sorted array of code points which may separate words + * @return the word that surrounds the cursor, including up to one trailing + * separator. For example, if the field contains "he|llo world", where | + * represents the cursor, then "hello " will be returned. + */ + public CharSequence getWordAtCursor(final int[] sortedSeparators) { + // getWordRangeAtCursor returns null if the connection is null + final TextRange r = getWordRangeAtCursor(sortedSeparators, 0); + return (r == null) ? null : r.mWord; + } + + /** * Returns the text surrounding the cursor. * * @param sortedSeparators a sorted array of code points that split words. + * @param additionalPrecedingWordsCount the number of words before the current word that should + * be included in the returned range * @return a range containing the text surrounding the cursor */ - public TextRange getWordRangeAtCursor(final int[] sortedSeparators) { - final int additionalPrecedingWordsCount = 0; + public TextRange getWordRangeAtCursor(final int[] sortedSeparators, + final int additionalPrecedingWordsCount) { mIC = mParent.getCurrentInputConnection(); if (mIC == null) { return null; diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index b9a87c921..8831d36f7 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -1288,7 +1288,8 @@ public final class InputLogic { return; } final TextRange range = mConnection.getWordRangeAtCursor( - settingsValues.mSpacingAndPunctuations.mSortedWordSeparators); + settingsValues.mSpacingAndPunctuations.mSortedWordSeparators, + 0 /* additionalPrecedingWordsCount */); if (null == range) return; // Happens if we don't have an input connection at all 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 |