aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/RichInputConnection.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2014-07-01 03:23:14 +0000
committerKen Wakasa <kwakasa@google.com>2014-07-01 03:23:14 +0000
commit7eef5d3ff4a0456335943e6a7494f540a7291017 (patch)
tree65d551ad9187b4a72cf278c5b02e208f6ebb9fb7 /java/src/com/android/inputmethod/latin/RichInputConnection.java
parent1d300239612591879d535c20ade1f2712048170e (diff)
downloadlatinime-7eef5d3ff4a0456335943e6a7494f540a7291017.tar.gz
latinime-7eef5d3ff4a0456335943e6a7494f540a7291017.tar.xz
latinime-7eef5d3ff4a0456335943e6a7494f540a7291017.zip
Revert "[SD5] Remove useless args"
This reverts commit 1d300239612591879d535c20ade1f2712048170e that broke the build. Bug: 15840116 Change-Id: I0a5fa7dea2b418d19df24b2b31ed96bf192d45c0
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java18
1 files changed, 16 insertions, 2 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;