am 52eb673c: Merge "Some cleanup"
* commit '52eb673c46d7be85237921866ec6a4f6357020fb': Some cleanupmain
commit
ea024589dc
|
@ -132,10 +132,15 @@ public final class WordComposer {
|
||||||
* Number of keystrokes in the composing word.
|
* Number of keystrokes in the composing word.
|
||||||
* @return the number of keystrokes
|
* @return the number of keystrokes
|
||||||
*/
|
*/
|
||||||
public final int size() {
|
// This may be made public if need be, but right now it's not used anywhere
|
||||||
|
/* package for tests */ int size() {
|
||||||
return mCodePointSize;
|
return mCodePointSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSingleLetter() {
|
||||||
|
return size() == 1;
|
||||||
|
}
|
||||||
|
|
||||||
// When the composition contains trailing quotes, we don't pass them to the suggestion engine.
|
// When the composition contains trailing quotes, we don't pass them to the suggestion engine.
|
||||||
// This is because "'tgis'" should be corrected to "'this'", but we can't afford to consider
|
// This is because "'tgis'" should be corrected to "'this'", but we can't afford to consider
|
||||||
// single quotes as separators because of their very common use as apostrophes.
|
// single quotes as separators because of their very common use as apostrophes.
|
||||||
|
|
|
@ -513,14 +513,12 @@ public final class InputLogic {
|
||||||
mWordComposer);
|
mWordComposer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final int wordComposerSize = mWordComposer.size();
|
|
||||||
// Since isComposingWord() is true, the size is at least 1.
|
|
||||||
if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
|
if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
|
||||||
// If we are in the middle of a recorrection, we need to commit the recorrection
|
// If we are in the middle of a recorrection, we need to commit the recorrection
|
||||||
// first so that we can insert the batch input at the current cursor position.
|
// first so that we can insert the batch input at the current cursor position.
|
||||||
resetEntireInputState(mConnection.getExpectedSelectionStart(),
|
resetEntireInputState(mConnection.getExpectedSelectionStart(),
|
||||||
mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
|
mConnection.getExpectedSelectionEnd(), true /* clearSuggestionStrip */);
|
||||||
} else if (wordComposerSize <= 1) {
|
} else if (mWordComposer.isSingleLetter()) {
|
||||||
// We auto-correct the previous (typed, not gestured) string iff it's one character
|
// We auto-correct the previous (typed, not gestured) string iff it's one character
|
||||||
// long. The reason for this is, even in the middle of gesture typing, you'll still
|
// long. The reason for this is, even in the middle of gesture typing, you'll still
|
||||||
// tap one-letter words and you want them auto-corrected (typically, "i" in English
|
// tap one-letter words and you want them auto-corrected (typically, "i" in English
|
||||||
|
@ -740,7 +738,7 @@ public final class InputLogic {
|
||||||
if (isComposingWord) {
|
if (isComposingWord) {
|
||||||
mWordComposer.add(inputTransaction.mEvent);
|
mWordComposer.add(inputTransaction.mEvent);
|
||||||
// If it's the first letter, make note of auto-caps state
|
// If it's the first letter, make note of auto-caps state
|
||||||
if (mWordComposer.size() == 1) {
|
if (mWordComposer.isSingleLetter()) {
|
||||||
// We pass 1 to getPreviousWordForSuggestion because we were not composing a word
|
// We pass 1 to getPreviousWordForSuggestion because we were not composing a word
|
||||||
// yet, so the word we want is the 1st word before the cursor.
|
// yet, so the word we want is the 1st word before the cursor.
|
||||||
mWordComposer.setCapitalizedModeAndPreviousWordAtStartComposingTime(
|
mWordComposer.setCapitalizedModeAndPreviousWordAtStartComposingTime(
|
||||||
|
|
Loading…
Reference in New Issue