aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-11-18 11:49:45 +0900
committerJean Chalard <jchalard@google.com>2014-11-18 11:52:35 +0900
commit6d1201915ddb2107a947759b722dda1c797d1034 (patch)
treed1a1c0bd6f41a70fbef5f5692dfe858b6717ed44 /java/src/com/android/inputmethod/latin
parentfdf92789c12ff0cba6130d3ca6848463417e3965 (diff)
downloadlatinime-6d1201915ddb2107a947759b722dda1c797d1034.tar.gz
latinime-6d1201915ddb2107a947759b722dda1c797d1034.tar.xz
latinime-6d1201915ddb2107a947759b722dda1c797d1034.zip
Rename a confusing method name
...and fix a bug that happened because of it. Bug: 18417740 Change-Id: I7a33780adcb8f4e2625abcd3eec906dfee1f5dcf
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index bafea178e..c034055ab 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -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