Rename some confusing variables

Change-Id: Ib0de800599ae7f12c86270a627616d5b52366414
main
Jean Chalard 2012-12-27 15:29:39 +09:00
parent 5bde3a6163
commit 0abc48218e
1 changed files with 12 additions and 12 deletions

View File

@ -534,17 +534,17 @@ public final class RichInputConnection {
// Going backward, alternate skipping non-separators and separators until enough words // Going backward, alternate skipping non-separators and separators until enough words
// have been read. // have been read.
int count = additionalPrecedingWordsCount; int count = additionalPrecedingWordsCount;
int start = before.length(); int startIndexInBefore = before.length();
boolean isStoppingAtWhitespace = true; // toggles to indicate what to stop at boolean isStoppingAtWhitespace = true; // toggles to indicate what to stop at
while (true) { // see comments below for why this is guaranteed to halt while (true) { // see comments below for why this is guaranteed to halt
while (start > 0) { while (startIndexInBefore > 0) {
final int codePoint = Character.codePointBefore(before, start); final int codePoint = Character.codePointBefore(before, startIndexInBefore);
if (isStoppingAtWhitespace == isSeparator(codePoint, sep)) { if (isStoppingAtWhitespace == isSeparator(codePoint, sep)) {
break; // inner loop break; // inner loop
} }
--start; --startIndexInBefore;
if (Character.isSupplementaryCodePoint(codePoint)) { if (Character.isSupplementaryCodePoint(codePoint)) {
--start; --startIndexInBefore;
} }
} }
// isStoppingAtWhitespace is true every other time through the loop, // isStoppingAtWhitespace is true every other time through the loop,
@ -557,20 +557,20 @@ public final class RichInputConnection {
} }
// Find last word separator after the cursor // Find last word separator after the cursor
int end = -1; int endIndexInAfter = -1;
while (++end < after.length()) { while (++endIndexInAfter < after.length()) {
final int codePoint = Character.codePointAt(after, end); final int codePoint = Character.codePointAt(after, endIndexInAfter);
if (isSeparator(codePoint, sep)) { if (isSeparator(codePoint, sep)) {
break; break;
} }
if (Character.isSupplementaryCodePoint(codePoint)) { if (Character.isSupplementaryCodePoint(codePoint)) {
++end; ++endIndexInAfter;
} }
} }
final String word = before.toString().substring(start, before.length()) final String word = before.toString().substring(startIndexInBefore, before.length())
+ after.toString().substring(0, end); + after.toString().substring(0, endIndexInAfter);
return new Range(before.length() - start, end, word); return new Range(before.length() - startIndexInBefore, endIndexInAfter, word);
} }
public boolean isCursorTouchingWord(final SettingsValues settingsValues) { public boolean isCursorTouchingWord(final SettingsValues settingsValues) {