From cf9d92629cae88273805eaf7984fcfdd8afd11f5 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 21 Feb 2012 23:11:07 -0800 Subject: Give LastComposedWord knowledge of the committed word (A1) There is no point storing the prospective autocorrect - we are recomputing it anyway. The committed word however will be necessary to implement feature request #5968922. Change-Id: I588c18e1a5a1050a791d601de465f421ccbe36cd --- java/src/com/android/inputmethod/latin/WordComposer.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java') diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index a1a329a8d..1f9371538 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -308,9 +308,10 @@ public class WordComposer { } // `type' should be one of the LastComposedWord.COMMIT_TYPE_* constants above. - public LastComposedWord commitWord(final int type) { + public LastComposedWord commitWord(final int type, final String committedWord) { // Note: currently, we come here whenever we commit a word. If it's any *other* kind than - // DECIDED_WORD, we should reset mAutoCorrection so that we don't attempt to cancel later. + // DECIDED_WORD, we should deactivate the last composed word so that we don't attempt to + // cancel later. // If it's a DECIDED_WORD, it may be an actual auto-correction by the IME, or what the user // typed because the IME decided *not* to auto-correct for whatever reason. // Ideally we would also null it when it was a DECIDED_WORD that was not an auto-correct. @@ -326,8 +327,7 @@ public class WordComposer { mXCoordinates = new int[N]; mYCoordinates = new int[N]; final LastComposedWord lastComposedWord = new LastComposedWord(codes, - xCoordinates, yCoordinates, mTypedWord.toString(), - null == mAutoCorrection ? null : mAutoCorrection.toString()); + xCoordinates, yCoordinates, mTypedWord.toString(), committedWord); if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) { lastComposedWord.deactivate(); } @@ -342,6 +342,6 @@ public class WordComposer { mYCoordinates = lastComposedWord.mYCoordinates; mTypedWord.setLength(0); mTypedWord.append(lastComposedWord.mTypedWord); - mAutoCorrection = lastComposedWord.mAutoCorrection; + mAutoCorrection = null; // This will be filled by the next call to updateSuggestion. } } -- cgit v1.2.3-83-g751a