From 8e829c37dff9fb5eec62390bf0e2c6f12fd6781b Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Fri, 28 Mar 2014 13:25:04 +0900 Subject: [CB14.5] Stop copying WordComposers. This is an overdue refactoring that I have been wanted to do forever, and that we can at last do now that suggestions come only from instances of BinaryDictionary instances. With this, all unit tests and regression tests are passing again. Bug: 13667648 Bug: 13665487 Bug: 8636060 Change-Id: Ie23a19f9b7e692edf2ee0b107ddaff2d7db564b6 --- .../android/inputmethod/latin/WordComposer.java | 26 ++++++---------------- 1 file changed, 7 insertions(+), 19 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 a955f375b..324683c86 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -104,25 +104,6 @@ public final class WordComposer { refreshSize(); } - public WordComposer(final WordComposer source) { - mCombinerChain = source.mCombinerChain; - mPrimaryKeyCodes = Arrays.copyOf(source.mPrimaryKeyCodes, source.mPrimaryKeyCodes.length); - mEvents = new ArrayList(source.mEvents); - mTypedWord = new StringBuilder(source.mTypedWord); - mInputPointers.copy(source.mInputPointers); - mCapsCount = source.mCapsCount; - mDigitsCount = source.mDigitsCount; - mIsFirstCharCapitalized = source.mIsFirstCharCapitalized; - mCapitalizedMode = source.mCapitalizedMode; - mTrailingSingleQuotesCount = source.mTrailingSingleQuotesCount; - mIsResumed = source.mIsResumed; - mIsBatchMode = source.mIsBatchMode; - mCursorPositionWithinWord = source.mCursorPositionWithinWord; - mRejectedBatchModeSuggestion = source.mRejectedBatchModeSuggestion; - mPreviousWordForSuggestion = source.mPreviousWordForSuggestion; - refreshSize(); - } - /** * Clear out the keys registered so far. */ @@ -155,6 +136,13 @@ public final class WordComposer { return mCodePointSize; } + // When the composition contains trailing quotes, we don't pass them to the suggestion engine. + // This is because "'tgis'" should be corrected to "'this'", but we can't afford to consider + // single quotes as separators because of their very common use as apostrophes. + public int sizeWithoutTrailingSingleQuotes() { + return size() - mTrailingSingleQuotesCount; + } + public final boolean isComposingWord() { return size() > 0; } -- cgit v1.2.3-83-g751a