aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-01-17 10:40:05 +0900
committerJean Chalard <jchalard@google.com>2014-01-27 18:17:33 +0900
commitc7ef305bbc119b820fd619d3ed205198d4f98c3f (patch)
treee219c2485b2da81ac5a9a6f2373dce60408bc765 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parent963d97af6d83f62c48a4395caca8ac64972f8a57 (diff)
downloadlatinime-c7ef305bbc119b820fd619d3ed205198d4f98c3f.tar.gz
latinime-c7ef305bbc119b820fd619d3ed205198d4f98c3f.tar.xz
latinime-c7ef305bbc119b820fd619d3ed205198d4f98c3f.zip
Try to figure out whether d.quotes open or close.
Bug: 8911672 Change-Id: I5d5635949530a67f95e5208986907251b7bce903
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 6e9bdc34a..d1b25141c 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -602,8 +602,21 @@ public final class InputLogic {
final boolean swapWeakSpace = maybeStripSpace(settingsValues, codePoint, spaceState,
isFromSuggestionStrip);
- if (SpaceState.PHANTOM == spaceState &&
- settingsValues.isUsuallyPrecededBySpace(codePoint)) {
+ final boolean isInsideDoubleQuoteOrAfterDigit = Constants.CODE_DOUBLE_QUOTE == codePoint
+ && mConnection.isInsideDoubleQuoteOrAfterDigit();
+
+ final boolean needsPrecedingSpace;
+ if (SpaceState.PHANTOM != spaceState) {
+ needsPrecedingSpace = false;
+ } else if (Constants.CODE_DOUBLE_QUOTE == codePoint) {
+ // Double quotes behave like they are usually preceded by space iff we are
+ // not inside a double quote or after a digit.
+ needsPrecedingSpace = !isInsideDoubleQuoteOrAfterDigit;
+ } else {
+ needsPrecedingSpace = settingsValues.isUsuallyPrecededBySpace(codePoint);
+ }
+
+ if (needsPrecedingSpace) {
promotePhantomSpace(settingsValues);
}
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
@@ -630,14 +643,17 @@ public final class InputLogic {
if (swapWeakSpace) {
swapSwapperAndSpace(keyboardSwitcher);
mSpaceState = SpaceState.SWAP_PUNCTUATION;
- } else if (SpaceState.PHANTOM == spaceState
- && settingsValues.isUsuallyFollowedBySpace(codePoint)) {
+ } else if ((SpaceState.PHANTOM == spaceState
+ && settingsValues.isUsuallyFollowedBySpace(codePoint))
+ || (Constants.CODE_DOUBLE_QUOTE == codePoint
+ && isInsideDoubleQuoteOrAfterDigit)) {
// If we are in phantom space state, and the user presses a separator, we want to
// stay in phantom space state so that the next keypress has a chance to add the
// space. For example, if I type "Good dat", pick "day" from the suggestion strip
// then insert a comma and go on to typing the next word, I want the space to be
// inserted automatically before the next word, the same way it is when I don't
- // input the comma.
+ // input the comma. A double quote behaves like it's usually followed by space if
+ // we're inside a double quote.
// The case is a little different if the separator is a space stripper. Such a
// separator does not normally need a space on the right (that's the difference
// between swappers and strippers), so we should not stay in phantom space state if