am a13a8a58: am 0e84041b: Refactor all phantom-space-inserted spaces in one place

* commit 'a13a8a58e05ecd3f9eccdc47ceca972a814d247e':
  Refactor all phantom-space-inserted spaces in one place
main
Jean Chalard 2012-11-12 23:04:37 -08:00 committed by Android Git Automerger
commit 3a9ba17fd2
1 changed files with 10 additions and 5 deletions

View File

@ -1405,7 +1405,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mHandler.postUpdateSuggestionStrip(); mHandler.postUpdateSuggestionStrip();
final CharSequence text = specificTldProcessingOnTextInput(rawText); final CharSequence text = specificTldProcessingOnTextInput(rawText);
if (SPACE_STATE_PHANTOM == mSpaceState) { if (SPACE_STATE_PHANTOM == mSpaceState) {
sendKeyCodePoint(Keyboard.CODE_SPACE); promotePhantomSpace();
} }
mConnection.commitText(text, 1); mConnection.commitText(text, 1);
mConnection.endBatchEdit(); mConnection.endBatchEdit();
@ -1568,7 +1568,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mWordComposer.setBatchInputWord(batchInputText); mWordComposer.setBatchInputWord(batchInputText);
mConnection.beginBatchEdit(); mConnection.beginBatchEdit();
if (SPACE_STATE_PHANTOM == mSpaceState) { if (SPACE_STATE_PHANTOM == mSpaceState) {
sendKeyCodePoint(Keyboard.CODE_SPACE); promotePhantomSpace();
} }
mConnection.setComposingText(batchInputText, 1); mConnection.setComposingText(batchInputText, 1);
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
@ -1724,7 +1724,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// Sanity check // Sanity check
throw new RuntimeException("Should not be composing here"); throw new RuntimeException("Should not be composing here");
} }
sendKeyCodePoint(Keyboard.CODE_SPACE); promotePhantomSpace();
} }
// NOTE: isCursorTouchingWord() is a blocking IPC call, so it often takes several // NOTE: isCursorTouchingWord() is a blocking IPC call, so it often takes several
@ -1802,7 +1802,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
if (SPACE_STATE_PHANTOM == spaceState && if (SPACE_STATE_PHANTOM == spaceState &&
mCurrentSettings.isPhantomSpacePromotingSymbol(primaryCode)) { mCurrentSettings.isPhantomSpacePromotingSymbol(primaryCode)) {
sendKeyCodePoint(Keyboard.CODE_SPACE); promotePhantomSpace();
} }
sendKeyCodePoint(primaryCode); sendKeyCodePoint(primaryCode);
@ -2071,7 +2071,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
int firstChar = Character.codePointAt(suggestion, 0); int firstChar = Character.codePointAt(suggestion, 0);
if ((!mCurrentSettings.isWeakSpaceStripper(firstChar)) if ((!mCurrentSettings.isWeakSpaceStripper(firstChar))
&& (!mCurrentSettings.isWeakSpaceSwapper(firstChar))) { && (!mCurrentSettings.isWeakSpaceSwapper(firstChar))) {
sendKeyCodePoint(Keyboard.CODE_SPACE); promotePhantomSpace();
} }
} }
@ -2249,6 +2249,11 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mHandler.postUpdateSuggestionStrip(); mHandler.postUpdateSuggestionStrip();
} }
// This essentially inserts a space, and that's it.
public void promotePhantomSpace() {
sendKeyCodePoint(Keyboard.CODE_SPACE);
}
// Used by the RingCharBuffer // Used by the RingCharBuffer
public boolean isWordSeparator(final int code) { public boolean isWordSeparator(final int code) {
return mCurrentSettings.isWordSeparator(code); return mCurrentSettings.isWordSeparator(code);