Skip to content
Snippets Groups Projects
Commit 87d907bd authored by Ken Wakasa's avatar Ken Wakasa Committed by Android (Google) Code Review
Browse files

Merge "Revert "[SD5] Remove useless args""

parents 35605db9 7eef5d3f
No related branches found
No related tags found
No related merge requests found
......@@ -619,14 +619,28 @@ public final class RichInputConnection {
return new PrevWordsInfo(prevWordsInfo);
}
/**
* @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;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment