Fix a bug where two spaces would be added instead of one
Bug: 6378291 Change-Id: Id2453333ae16146f816faf0eb68baa8ea1dd106a
This commit is contained in:
parent
96fb3094aa
commit
551612dd9e
1 changed files with 16 additions and 15 deletions
|
@ -1796,6 +1796,22 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final InputConnection ic = getCurrentInputConnection();
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
if (ic != null) ic.beginBatchEdit();
|
if (ic != null) ic.beginBatchEdit();
|
||||||
|
|
||||||
|
// If this is a punctuation picked from the suggestion strip, pass it to onCodeInput
|
||||||
|
if (suggestion.length() == 1 && isShowingPunctuationList()) {
|
||||||
|
// Word separators are suggested before the user inputs something.
|
||||||
|
// So, LatinImeLogger logs "" as a user's input.
|
||||||
|
LatinImeLogger.logOnManualSuggestion("", suggestion.toString(), index, suggestedWords);
|
||||||
|
// Rely on onCodeInput to do the complicated swapping/stripping logic consistently.
|
||||||
|
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
|
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, x, y);
|
||||||
|
}
|
||||||
|
final int primaryCode = suggestion.charAt(0);
|
||||||
|
onCodeInput(primaryCode,
|
||||||
|
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
|
||||||
|
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SPACE_STATE_PHANTOM == mSpaceState && suggestion.length() > 0) {
|
if (SPACE_STATE_PHANTOM == mSpaceState && suggestion.length() > 0) {
|
||||||
int firstChar = Character.codePointAt(suggestion, 0);
|
int firstChar = Character.codePointAt(suggestion, 0);
|
||||||
if ((!mSettingsValues.isWeakSpaceStripper(firstChar))
|
if ((!mSettingsValues.isWeakSpaceStripper(firstChar))
|
||||||
|
@ -1823,21 +1839,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a punctuation picked from the suggestion strip, pass it to onCodeInput
|
|
||||||
if (suggestion.length() == 1 && isShowingPunctuationList()) {
|
|
||||||
// Word separators are suggested before the user inputs something.
|
|
||||||
// So, LatinImeLogger logs "" as a user's input.
|
|
||||||
LatinImeLogger.logOnManualSuggestion("", suggestion.toString(), index, suggestedWords);
|
|
||||||
// Rely on onCodeInput to do the complicated swapping/stripping logic consistently.
|
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
|
||||||
ResearchLogger.latinIME_punctuationSuggestion(index, suggestion, x, y);
|
|
||||||
}
|
|
||||||
final int primaryCode = suggestion.charAt(0);
|
|
||||||
onCodeInput(primaryCode,
|
|
||||||
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE,
|
|
||||||
KeyboardActionListener.SUGGESTION_STRIP_COORDINATE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// We need to log before we commit, because the word composer will store away the user
|
// We need to log before we commit, because the word composer will store away the user
|
||||||
// typed word.
|
// typed word.
|
||||||
final String replacedWord = mWordComposer.getTypedWord().toString();
|
final String replacedWord = mWordComposer.getTypedWord().toString();
|
||||||
|
|
Loading…
Reference in a new issue