Rename a confusing method name

...and fix a bug that happened because of it.

Bug: 18417740
Change-Id: I7a33780adcb8f4e2625abcd3eec906dfee1f5dcf
main
Jean Chalard 2014-11-18 11:49:45 +09:00
parent fdf92789c1
commit 6d1201915d
1 changed files with 12 additions and 10 deletions

View File

@ -255,7 +255,7 @@ public final class InputLogic {
handler.postUpdateSuggestionStrip(SuggestedWords.INPUT_STYLE_TYPING);
final String text = performSpecificTldProcessingOnTextInput(rawText);
if (SpaceState.PHANTOM == mSpaceState) {
promotePhantomSpace(settingsValues);
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
}
mConnection.commitText(text, 1);
StatsUtils.onWordCommitUserTyped(mEnteredText, mWordComposer.isBatchMode());
@ -322,7 +322,7 @@ public final class InputLogic {
final int firstChar = Character.codePointAt(suggestion, 0);
if (!settingsValues.isWordSeparator(firstChar)
|| settingsValues.isUsuallyPrecededBySpace(firstChar)) {
promotePhantomSpace(settingsValues);
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
}
}
@ -584,7 +584,9 @@ public final class InputLogic {
if (candidate.mSourceDict.shouldAutoCommit(candidate)) {
final String[] commitParts = candidate.mWord.split(Constants.WORD_SEPARATOR, 2);
batchPointers.shift(candidate.mIndexOfTouchPointOfSecondWord);
promotePhantomSpace(settingsValues);
if (SpaceState.PHANTOM == mSpaceState) {
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
}
mConnection.commitText(commitParts[0], 0);
StatsUtils.onWordCommitUserTyped(commitParts[0], mWordComposer.isBatchMode());
mSpaceState = SpaceState.PHANTOM;
@ -861,7 +863,7 @@ public final class InputLogic {
// Sanity check
throw new RuntimeException("Should not be composing here");
}
promotePhantomSpace(settingsValues);
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
}
if (mWordComposer.isCursorFrontOrMiddleOfComposingWord()) {
@ -972,7 +974,7 @@ public final class InputLogic {
}
if (needsPrecedingSpace) {
promotePhantomSpace(settingsValues);
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
}
if (tryPerformDoubleSpacePeriod(event, inputTransaction)) {
@ -1960,14 +1962,14 @@ public final class InputLogic {
}
/**
* Promote a phantom space to an actual space.
* Insert an automatic space, if the options allow it.
*
* This essentially inserts a space, and that's it. It just checks the options and the text
* before the cursor are appropriate before doing it.
* This checks the options and the text before the cursor are appropriate before inserting
* an automatic space.
*
* @param settingsValues the current values of the settings.
*/
private void promotePhantomSpace(final SettingsValues settingsValues) {
private void insertAutomaticSpaceIfOptionsAndTextAllow(final SettingsValues settingsValues) {
if (settingsValues.shouldInsertSpacesAutomatically()
&& settingsValues.mSpacingAndPunctuations.mCurrentLanguageHasSpaces
&& !mConnection.textBeforeCursorLooksLikeURL()) {
@ -1990,7 +1992,7 @@ public final class InputLogic {
}
mConnection.beginBatchEdit();
if (SpaceState.PHANTOM == mSpaceState) {
promotePhantomSpace(settingsValues);
insertAutomaticSpaceIfOptionsAndTextAllow(settingsValues);
}
final SuggestedWordInfo autoCommitCandidate = mSuggestedWords.getAutoCommitCandidate();
// Commit except the last word for phrase gesture if the top suggestion is eligible for auto