aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/WordComposer.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-03-28 13:25:04 +0900
committerJean Chalard <jchalard@google.com>2014-03-28 15:26:27 +0900
commit8e829c37dff9fb5eec62390bf0e2c6f12fd6781b (patch)
tree35712e6dc2c9178cd838a0e30c2552f4477c8d8a /java/src/com/android/inputmethod/latin/WordComposer.java
parent2f781026ccfadc2ad91e5c57ff59ecb27dd192e9 (diff)
downloadlatinime-8e829c37dff9fb5eec62390bf0e2c6f12fd6781b.tar.gz
latinime-8e829c37dff9fb5eec62390bf0e2c6f12fd6781b.tar.xz
latinime-8e829c37dff9fb5eec62390bf0e2c6f12fd6781b.zip
[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
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java26
1 files changed, 7 insertions, 19 deletions
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<Event>(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;
}