aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-05-30 20:30:17 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2014-05-30 20:30:17 +0900
commit8f71fab2ed619e34222a172a5004d7f91b4520a6 (patch)
treeef95ddbd77132cfae9d2ced327f28b159005458d /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parentfa0e76dde606c288e4df20b779995cbce3b187fb (diff)
downloadlatinime-8f71fab2ed619e34222a172a5004d7f91b4520a6.tar.gz
latinime-8f71fab2ed619e34222a172a5004d7f91b4520a6.tar.xz
latinime-8f71fab2ed619e34222a172a5004d7f91b4520a6.zip
Make prevWord = null if the next word starts from a connector.
This fixes PunctuationTests# testAutoCorrectionWithSingleQuotesAround. Bug: 14119293 Bug: 15334309 Change-Id: I604c21a21e89a5fc431fd56ab7b6ad03f4736b01
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index d4833f5fc..f36b42a40 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -704,11 +704,10 @@ public final class InputLogic {
(!mConnection.isCursorTouchingWord(settingsValues.mSpacingAndPunctuations)
|| !settingsValues.mSpacingAndPunctuations.mCurrentLanguageHasSpaces)) {
// Reset entirely the composing state anyway, then start composing a new word unless
- // the character is a single quote or a dash. The idea here is, single quote and dash
- // are not separators and they should be treated as normal characters, except in the
- // first position where they should not start composing a word.
- isComposingWord = (Constants.CODE_SINGLE_QUOTE != codePoint
- && Constants.CODE_DASH != codePoint);
+ // the character is a word connector. The idea here is, word connectors are not
+ // separators and they should be treated as normal characters, except in the first
+ // position where they should not start composing a word.
+ isComposingWord = !settingsValues.mSpacingAndPunctuations.isWordConnector(codePoint);
// Here we don't need to reset the last composed word. It will be reset
// when we commit this one, if we ever do; if on the other hand we backspace
// it entirely and resume suggestions on the previous word, we'd like to still
@@ -719,12 +718,15 @@ public final class InputLogic {
mWordComposer.processEvent(inputTransaction.mEvent);
// If it's the first letter, make note of auto-caps state
if (mWordComposer.isSingleLetter()) {
- // We pass 1 to getPreviousWordForSuggestion because we were not composing a word
- // yet, so the word we want is the 1st word before the cursor.
+ // We pass 2 to getPreviousWordForSuggestion when the previous code point is a word
+ // connector. Otherwise, we pass 1 because we were not composing a word yet, so the
+ // word we want is the 1st word before the cursor.
mWordComposer.setCapitalizedModeAndPreviousWordAtStartComposingTime(
inputTransaction.mShiftState,
getPrevWordsInfoFromNthPreviousWordForSuggestion(
- settingsValues.mSpacingAndPunctuations, 1 /* nthPreviousWord */));
+ settingsValues.mSpacingAndPunctuations,
+ settingsValues.mSpacingAndPunctuations.isWordConnector(
+ mConnection.getCodePointBeforeCursor()) ? 2 : 1));
}
mConnection.setComposingText(getTextWithUnderline(
mWordComposer.getTypedWord()), 1);